Macros | |
#define | WIFI_1X_TLS_HS_FLAGS_DEFAULT |
#define | WIFI_1X_TLS_HS_FLAGS_PEER_AUTH NBIT1 |
#define | WIFI_1X_TLS_HS_FLAGS_PEER_CERTTIMECHECK NBIT2 |
#define | WIFI_1X_TLS_HS_FLAGS_REQUIRE_TIME NBIT3 |
#define | WIFI_1X_TLS_HS_FLAGS_RSV5 NBIT5 |
#define | WIFI_1X_TLS_HS_FLAGS_RSV7 NBIT7 |
#define | WIFI_1X_TLS_HS_FLAGS_SESSION_CACHING NBIT4 |
#define | WIFI_1X_TLS_HS_FLAGS_SPECIFY_ROOTCERT NBIT6 |
Functions | |
static sint8 | m2m_validate_ap_parameters (CONST tstrM2MAPModeConfig *pstrM2MAPModeConfig) |
static sint8 | m2m_validate_scan_options (tstrM2MScanOption *ptstrM2MScanOption) |
static void | m2m_wifi_cb (uint8 u8OpCode, uint16 u16DataSize, uint32 u32Addr) |
static sint8 | m2m_wifi_connect_prepare_msg (tenuCredStoreOption enuCredStoreOption, tenuM2mSecType enuAuthType, uint16 u16AuthSize, tstrNetworkId *pstrNetworkId, tstrM2mWifiConnHdr *pstrWifiConn) |
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... | |
sint8 | m2m_wifi_disconnect (void) |
Synchronous API to request disconnection from a network. More... | |
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... | |
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... | |
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 *pWifiInitParam) |
Synchronous API to initialize the WINC driver. More... | |
sint8 | m2m_wifi_p2p (uint8 u8Channel) |
sint8 | m2m_wifi_p2p_disconnect (void) |
sint8 | m2m_wifi_req_client_ctrl (uint8 u8Cmd) |
Send a command to the PS Client (An WINC board running the ps_firmware), if the PS client send any commands it will be received in wifi_cb M2M_WIFI_RESP_CLIENT_INFO. More... | |
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_req_server_init (uint8 ch) |
Initialize the PS Server, The WINC support non secure communication with another WINC, (SERVER/CLIENT) through one byte command (probe request and probe response) without any connection setup. More... | |
sint8 | m2m_wifi_request_scan (uint8 ch) |
Asynchronous API to request the WINC IC to scan for networks. More... | |
sint8 | m2m_wifi_send_crl (tstrTlsCrlInfo *pCRL) |
Asynchronous API that notifies the WINC with the Certificate Revocation List. More... | |
sint8 | m2m_wifi_set_cust_InfoElement (uint8 *pau8M2mCustInfoElement) |
API to add or remove a user-defined Information Element. More... | |
sint8 | m2m_wifi_set_device_name (uint8 *pu8DeviceName, uint8 u8DeviceNameLength) |
Set the WILC1000 device name which is used as P2P device name. 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... | |
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_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... | |
Variables | |
static uint8 | gau81xRootSha1 [20] = {0} |
static uint8 * | gau8ethRcvBuf =NULL |
static tpfAppEthCb | gpfAppEthCb = NULL |
static tpfAppWifiCb | gpfAppWifiCb = NULL |
static uint16 | gu16ethRcvBufSize |
static uint32 | gu321xTlsHsFlags = WIFI_1X_TLS_HS_FLAGS_DEFAULT |
static volatile uint8 | gu8ChNum |
static volatile uint8 | gu8scanInProgress = 0 |
static volatile uint8 | gu8WifiState = WIFI_STATE_DEINIT |
#define WIFI_1X_TLS_HS_FLAGS_DEFAULT |
#define WIFI_1X_TLS_HS_FLAGS_PEER_AUTH NBIT1 |
Referenced by m2m_wifi_1x_get_option(), and m2m_wifi_1x_set_option().
#define WIFI_1X_TLS_HS_FLAGS_PEER_CERTTIMECHECK NBIT2 |
Referenced by m2m_wifi_1x_get_option(), and m2m_wifi_1x_set_option().
#define WIFI_1X_TLS_HS_FLAGS_REQUIRE_TIME NBIT3 |
Referenced by m2m_wifi_1x_get_option(), and m2m_wifi_1x_set_option().
#define WIFI_1X_TLS_HS_FLAGS_RSV5 NBIT5 |
#define WIFI_1X_TLS_HS_FLAGS_RSV7 NBIT7 |
#define WIFI_1X_TLS_HS_FLAGS_SESSION_CACHING NBIT4 |
Referenced by m2m_wifi_1x_get_option(), and m2m_wifi_1x_set_option().
#define WIFI_1X_TLS_HS_FLAGS_SPECIFY_ROOTCERT NBIT6 |
Referenced by m2m_wifi_1x_get_option(), and m2m_wifi_1x_set_option().
|
static |
References M2M_ERR, M2M_ERR_FAIL, M2M_MAX_PSK_LEN, M2M_MAX_SSID_LEN, M2M_MIN_PSK_LEN, m2m_strlen(), M2M_SUCCESS, M2M_WIFI_CH_1, M2M_WIFI_CH_14, M2M_WIFI_SEC_OPEN, M2M_WIFI_SEC_WEP, M2M_WIFI_SEC_WPA_PSK, NULL, WEP_104_KEY_STRING_SIZE, WEP_40_KEY_STRING_SIZE, and WEP_KEY_MAX_INDEX.
Referenced by m2m_wifi_enable_ap_ext(), and m2m_wifi_start_provision_mode_ext().
|
static |
References BYTE_0, BYTE_1, BYTE_2, BYTE_3, gau8ethRcvBuf, gpfAppEthCb, gpfAppWifiCb, gu16ethRcvBufSize, gu8ChNum, gu8scanInProgress, hif_receive(), M2M_ERR, M2M_INFO, m2m_memcpy(), m2m_memset(), M2M_SUCCESS, M2M_WIFI_REQ_DHCP_CONF, M2M_WIFI_REQ_DHCP_FAILURE, M2M_WIFI_REQ_WPS, M2M_WIFI_REQRSP_DELETE_APID, M2M_WIFI_RESP_CLIENT_INFO, M2M_WIFI_RESP_CON_STATE_CHANGED, M2M_WIFI_RESP_CONN_INFO, M2M_WIFI_RESP_CURRENT_RSSI, M2M_WIFI_RESP_DEFAULT_CONNECT, M2M_WIFI_RESP_ETHERNET_RX_PACKET, M2M_WIFI_RESP_GET_PRNG, M2M_WIFI_RESP_GET_SYS_TIME, M2M_WIFI_RESP_IP_CONFLICT, M2M_WIFI_RESP_MEMORY_RECOVER, M2M_WIFI_RESP_PROVISION_INFO, M2M_WIFI_RESP_SCAN_DONE, M2M_WIFI_RESP_SCAN_RESULT, NULL, tstrPrng::pu8RngBuff, rx_buf, tstrM2mIpCtrlBuf::u16DataSize, tstrM2mIpRsvdPkt::u16PktOffset, tstrM2mIpRsvdPkt::u16PktSz, tstrPrng::u16PrngSize, tstrM2mIpCtrlBuf::u16RemainingDataSize, tstrM2mWifiStateChanged::u8CurrState, and tstrM2mScanDone::u8NumofCh.
Referenced by m2m_wifi_init_start().
|
static |
References tstrM2mConnCredCmn::au8Bssid, tstrM2mConnCredCmn::au8Ssid, tstrNetworkId::enuChannel, M2M_CRED_ENCRYPT_FLAG, M2M_CRED_STORE_FLAG, M2M_ERR_FAIL, M2M_ERR_INVALID_ARG, M2M_MAC_ADDRES_LEN, M2M_MAX_SSID_LEN, m2m_memcpy(), m2m_memset(), M2M_SUCCESS, M2M_WIFI_CH_1, M2M_WIFI_CH_14, M2M_WIFI_CH_ALL, M2M_WIFI_CONN_BSSID_FLAG, M2M_WIFI_NUM_AUTH_TYPES, M2M_WIFI_SEC_INVALID, NULL, tstrNetworkId::pu8Bssid, tstrNetworkId::pu8Ssid, tstrM2mWifiConnHdr::strConnCredCmn, tstrM2mWifiConnHdr::strConnCredHdr, tstrM2mConnCredHdr::u16CredSize, tstrM2mConnCredCmn::u8AuthType, tstrM2mConnCredHdr::u8Channel, tstrM2mConnCredHdr::u8CredStoreFlags, tstrM2mConnCredCmn::u8Options, tstrNetworkId::u8SsidLen, tstrM2mConnCredCmn::u8SsidLen, WIFI_CRED_DONTSAVE, WIFI_CRED_SAVE_ENCRYPTED, and WIFI_CRED_SAVE_UNENCRYPTED.
Referenced by m2m_wifi_connect_1x_mschap2(), m2m_wifi_connect_1x_tls(), m2m_wifi_connect_open(), m2m_wifi_connect_psk(), and m2m_wifi_connect_wep().
sint8 m2m_wifi_deinit | ( | void * | arg | ) |
De-initialize the WINC driver and host interface.
Synchronous API to de-initialize the WINC driver and host interface.
[in] | arg | Generic argument. Not used in current implementation. |
Synchronous de-initialization function for the WINC driver. De-initializes the host interface and frees any resources used by the M2M_WIFI layer. This function must be called in the application closing phase to ensure that all resources have been correctly released. No arguments are expected to be passed in.
[in] | arg | Opaque argument, not used in current implementation. Application should use null. |
De-initialization function for the WINC driver. De-initializes the host interface and frees any resources used by the M2M_WIFI layer. This function must be called in the application closing phase to ensure that all resources have been correctly released.
[in] | arg | Opaque argument, not used in current implementation. Application should use null. |
References gu8WifiState, hif_deinit(), M2M_SUCCESS, nm_drv_deinit(), NULL, and WIFI_STATE_DEINIT.
sint8 m2m_wifi_disable_ap | ( | void | ) |
Synchronous API to disable access point mode on the WINC IC.
Synchronous API to disable access point mode on the WINC.
Must be called only when the AP is enabled through the @ref m2m_wifi_enable_ap function. Otherwise the call to this function will not be useful.
References hif_send(), M2M_REQ_GROUP_WIFI, M2M_SUCCESS, M2M_WIFI_REQ_DISABLE_AP, and NULL.
sint8 m2m_wifi_disconnect | ( | void | ) |
Synchronous API to request disconnection from a network.
Request a Wi-Fi disconnect from the currently connected AP. After the disconnect is complete the driver should receive a response of @ref M2M_WIFI_RESP_CON_STATE_CHANGED based on the states defined in @ref tenuM2mConnState, successful disconnection is defined by @ref M2M_WIFI_DISCONNECTED .
Request a Wi-Fi disconnect from the currently connected AP. The connection status will be indicated to the application via a @ref M2M_WIFI_RESP_CON_STATE_CHANGED event. The status will be one of those defined in @ref tenuM2mConnState, with @ref M2M_WIFI_DISCONNECTED indicating a successful disconnection.
References hif_send(), M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_DISCONNECT, and NULL.
sint8 m2m_wifi_enable_ap | ( | CONST tstrM2MAPConfig * | pstrM2MAPConfig | ) |
Asynchronous API to enable access point (AKA "hot-spot") mode on the WINC IC.
Asynchronous API to enable access point (AKA "hot-spot") mode on the WINC.
[in] | pstrM2MAPConfig | A structure holding the AP configurations. |
The code snippet demonstrates how the AP mode is enabled after the driver is initialized in the application's main function
The WINC IC supports the ability to operate as an access point with the following limitations: - Only 1 station may be associated at any given time. - Open system and WEP are the only security suites supported.
[in] | pstrM2MAPConfig | A structure holding the AP configurations. |
The code snippet demonstrates how the AP mode is enabled after the driver is initialized in the application's main function and the handling of the event M2M_WIFI_REQ_DHCP_CONF, to indicate successful connection.
The WINC supports the ability to operate as an access point with the following limitations: - Only 1 station may be associated at any given time. - Open system and WEP are the only security suites supported.
[in] | pstrM2MAPConfig | A structure holding the AP configurations. |
The code snippet demonstrates how the AP mode is enabled after the driver is initialized in the application's main function and the handling of the event M2M_WIFI_REQ_DHCP_CONF, to indicate successful connection.
References tstrM2MAPConfigExt::au8DefRouterIP, tstrM2MAPConfigExt::au8DNSServerIP, tstrM2MAPConfigExt::au8SubnetMask, m2m_memcpy(), m2m_wifi_enable_ap_ext(), tstrM2MAPModeConfig::strApConfig, and tstrM2MAPModeConfig::strApConfigExt.
Add MAC filter to receive Multicast packets.
Asynchronous API to add or remove MAC addresses to the multicast filter.
Synchronous function for filtering received MAC addresses.
[in] | pu8MulticastMacAddress | Pointer to the MAC address. |
[in] | u8AddRemove | Flag to Add/Remove MAC address. |
Synchronous function for filtering received MAC addresses from certain MAC address groups. This function allows the addition/removal of certain MAC addresses, used in the multicast filter.
[in] | pu8MulticastMacAddress | Pointer to MAC address |
[in] | u8AddRemove | A flag to add or remove the MAC ADDRESS, based on the following values:
|
This function will configure the WINC to receive/ignore multicast packets from certain MAC address groups when operating in bypass mode. This function requests the given MAC addresses to be added/removed from the multicast filter.
[in] | pu8MulticastMacAddress | Pointer to MAC address |
[in] | u8AddRemove | A flag to add or remove the MAC ADDRESS, based on the following values:
|
References tstrM2MMulticastMac::au8macaddress, hif_send(), M2M_DBG, M2M_ERR_FAIL, M2M_MAC_ADDRES_LEN, m2m_memcpy(), M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_MAC_MCAST, NULL, and tstrM2MMulticastMac::u8AddRemove.
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.
Asynchronous API for retrieving the WINC connection status.
Asynchronous API for retrieving the WINC IC's connection status.
The code snippet shows an example of how wi-fi connection information is retrieved .
Asynchronous connection status retrieval function, retrieves the status information of the currently connected AP. The result is passed to the Wi-Fi notification callback through the event @ref M2M_WIFI_RESP_CONN_INFO. Connection information is retrieved from the structure @ref tstrM2MConnInfo. Connection Information retrieved: -Connection Security -Connection RSSI -Remote MAC address -Remote IP address In case the WINC is operating in station mode, the SSID of the AP is also retrieved.
The code snippet shows an example of how wi-fi connection information is retrieved .
Requests the connection status from the WINC including information regarding any access point to which it is currently connected, or any non-AP station that is connected to the WINC. All information will be returned to the application via the Wi-Fi notification callback through the event @ref M2M_WIFI_RESP_CONN_INFO. The connection info can be retrieved using the structure @ref tstrM2MConnInfo which contains: - Connection Security - Connection RSSI - Remote MAC address - Remote IP address - SSID of the network (in cases where the WINC is in non-AP mode)
The code snippet shows an example of how wi-fi connection information is retrieved .
References hif_send(), M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_GET_CONN_INFO, and NULL.
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.
Synchronous function to retrieve the number of AP's found during the last scan operation.
The code snippet demonstrates an example of how the scan request is called from the application's main function and the handling of the events received in response.
The function reads the number of APs from global variable which was updated in the Wi-Fi callback function through the @ref M2M_WIFI_RESP_SCAN_DONE event. Function used only in STA mode only.
The code snippet demonstrates an example of how the scan request is called from the application's main function and the handling of the events received in response.
This function allows the application to recover the number of access points discovered during the most recent scan activity. This is achieved via a global variable in the WINC driver that is populated when receiving the @ref M2M_WIFI_RESP_SCAN_DONE event. Function to be used in STA mode only.
The code snippet demonstrates an example of how the scan request is called from the application's main function and the handling of the events received in response.
References gu8ChNum.
Request the MAC address stored on the OTP (one time programmable) memory of the device. (the function is Blocking until response received)
Synchronous API to query the MAC address programmed into the WINC OTP memory.
Synchronous API to query the MAC address programmed into the WINC ICs OTP memory.
[out] | pu8MacAddr | Output MAC address buffer of 6 bytes size. Valid only if *pu8Valid=1. |
[out] | pu8IsValid | A output boolean value to indicate the validity of pu8MacAddr in OTP. Output zero if the OTP memory is not programmed, non-zero otherwise. |
[out] | pu8MacAddr | Output MAC address buffer of 6 bytes size. Valid only if *pu8Valid=1. |
[out] | pu8IsValid | A output boolean value to indicate the validity of pu8MacAddr in OTP. Output zero if the OTP memory is not programmed, non-zero otherwise. |
This function attempts to read the device's MAC address from the One Time Programmable (OTP) memory on the IC. The presence (yes or no) of a MAC address in the OTP memory and, in the case of it being present, its value is returned via RAM pointed to by the input arguments. Request the MAC address stored on the One Time Programmable(OTP) memory of the device. The function is blocking until the response is received.
[out] | pu8MacAddr | Output MAC address buffer 6 bytes in size. Valid only if *pu8Valid=1. |
[out] | pu8IsValid | A boolean value set by the callee to indicate the validity of pu8MacAddr in OTP. If no MAC has been programmed in the OTP the value of this parameter will be zero; otherwise it will be non-zero. |
This function attempts to read the device's MAC address from the One Time Programmable (OTP) memory on the WINC. The presence (yes or no) of a MAC address in the OTP memory and, in the case of it being present, its value is returned via RAM pointed to by the input arguments. Request the MAC address stored on the One Time Programmable(OTP) memory of the device. The function is blocking until the response is received.
[out] | pu8MacAddr | Output MAC address buffer 6 bytes in size. Valid only if *pu8Valid=1. |
[out] | pu8IsValid | A boolean value set by the callee to indicate the validity of pu8MacAddr in OTP. If no MAC has been programmed in the OTP the value of this parameter will be zero; otherwise it will be non-zero. |
References hif_chip_sleep(), hif_chip_wake(), M2M_SUCCESS, and nmi_get_otp_mac_address().
uint8 m2m_wifi_get_sleep_mode | ( | void | ) |
Get the current Power save mode.
Synchronous API to retrieve the current power save mode of the WINC.
Synchronous power save mode retrieval function.
References hif_get_sleep_mode().
sint8 m2m_wifi_handle_events | ( | void * | arg | ) |
Synchronous M2M event handler function.
This function is responsible for handling interrupts received from the WINC firmware. Applications should call this function periodically in-order to receive the events that are to be handled by the callback functions implemented by the application. Handle the various events received from the WINC board. Whenever an event happens in the WINC board (e.g. Connection, Disconnection, DHCP, etc), the WINC will interrupt the host to let it know that a new event has occurred. The host driver will attempt to handle these events whenever the application decides to do so by calling the m2m_wifi_handle_events function. It is mandatory to call this function periodically and independently of any other condition. It is ideal to include this function in the main and the most frequent loop of the host application.
This function is responsible for handling interrupts received from the WINC firmware. Applications should call this function periodically in-order to receive the events that are to be handled by the callback functions implemented by the application. Handle the various events received from the WINC. Whenever an event happens in the WINC (e.g. Connection, Disconnection, DHCP, etc), the WINC will interrupt the host to let it know that a new event has occurred. The host driver will attempt to handle these events whenever the application decides to do so by calling the m2m_wifi_handle_events function. It is mandatory to call this function periodically and independently of any other condition. It is ideal to include this function in the main and the most frequent loop of the host application.
References hif_handle_isr().
sint8 m2m_wifi_init | ( | tstrWifiInitParam * | pWifiInitParam | ) |
Synchronous API to initialize the WINC driver.
[in] | pWifiInitParam | This is a pointer to the tstrWifiInitParam structure which holds the pointer to the application WIFI layer call back function, monitoring mode call back and tstrEthInitParam strucutre. |
This function initializes the WINC driver by registering the callback function for the M2M_WIFI layer (also the callback function for bypass mode/monitoring mode if defined), initializing the host interface layer and the bus interfaces. Wi-Fi callback registering is essential to allow the handling of the events received, in response to the asynchronous Wi-Fi operations. The possible Wi-Fi events that are expected to be received through the callback function (provided by the application) to the M2M_WIFI layer are listed below: - @ref M2M_WIFI_RESP_CON_STATE_CHANGED - @ref M2M_WIFI_RESP_CONN_INFO - @ref M2M_WIFI_REQ_DHCP_CONF - @ref M2M_WIFI_REQ_WPS - @ref M2M_WIFI_RESP_IP_CONFLICT - @ref M2M_WIFI_RESP_SCAN_DONE - @ref M2M_WIFI_RESP_SCAN_RESULT - @ref M2M_WIFI_RESP_CURRENT_RSSI - @ref M2M_WIFI_RESP_CLIENT_INFO - @ref M2M_WIFI_RESP_PROVISION_INFO - @ref M2M_WIFI_RESP_DEFAULT_CONNECT - @ref M2M_WIFI_RESP_ETHERNET_RX_PACKET (if bypass mode is enabled) - @ref M2M_WIFI_RESP_WIFI_RX_PACKET (if monitoring mode is enabled) Any application using the WINC driver must call this function at the start of its main function.
[in] | pWifiInitParam | This is a pointer to a structure of type tstrWifiInitParam which contains pointers to the application WIFI layer callback function, monitoring mode callback and tstrEthInitParam structure (which contains initialization settings for bypass mode). |
This function initializes the WINC driver by registering the callback function for the M2M_WIFI layer (also the callback function for bypass mode/monitoring mode if defined), initializing the host interface layer and the bus interfaces. Wi-Fi callback registering is essential to allow the handling of the events received, in response to the asynchronous Wi-Fi operations. The possible Wi-Fi events that are expected to be received through the callback function (provided by the application) to the M2M_WIFI layer are listed below: - @ref M2M_WIFI_RESP_CON_STATE_CHANGED - @ref M2M_WIFI_RESP_CONN_INFO - @ref M2M_WIFI_REQ_DHCP_CONF - @ref M2M_WIFI_REQ_WPS - @ref M2M_WIFI_RESP_IP_CONFLICT - @ref M2M_WIFI_RESP_SCAN_DONE - @ref M2M_WIFI_RESP_SCAN_RESULT - @ref M2M_WIFI_RESP_CURRENT_RSSI - @ref M2M_WIFI_RESP_CLIENT_INFO - @ref M2M_WIFI_RESP_PROVISION_INFO - @ref M2M_WIFI_RESP_DEFAULT_CONNECT - @ref M2M_WIFI_RESP_ETHERNET_RX_PACKET (if bypass mode is enabled) - @ref M2M_WIFI_RESP_WIFI_RX_PACKET (if monitoring mode is enabled) Any application using the WINC driver must call this function at the start of its main function.
[in] | pWifiInitParam | This is a pointer to a variable of type tstrWifiInitParam which contains pointers to the application WIFI layer callback function, monitoring mode callback and tstrEthInitParam structure (which contains initialization settings for bypass mode). |
References M2M_SUCCESS, m2m_wifi_init_hold(), and m2m_wifi_init_start().
sint8 m2m_wifi_p2p_disconnect | ( | void | ) |
References hif_send(), M2M_REQ_GROUP_WIFI, M2M_SUCCESS, M2M_WIFI_REQ_DISABLE_P2P, and NULL.
Send a command to the PS Client (An WINC board running the ps_firmware), if the PS client send any commands it will be received in wifi_cb M2M_WIFI_RESP_CLIENT_INFO.
Asynchronous command sending function to the PS Client.
[in] | cmd | Control command sent from PS Server to PS Client (command values defined by the application). |
Asynchronous command sending function to the PS Client (a WINC board running the ps_firmware) if the PS client sends any command, it will be received through the @ref M2M_WIFI_RESP_CLIENT_INFO event.
[in] | cmd | Control command sent from PS Server to PS Client (command values defined by the application) |
References hif_send(), M2M_ERR, M2M_REQ_GROUP_WIFI, M2M_SUCCESS, M2M_WIFI_REQ_CLIENT_CTRL, NULL, and tstrM2Mservercmd::u8cmd.
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.
Asynchronous API to request the current Receive Signal Strength (RSSI) of the current connection.
The code snippet demonstrates how the rssi request is called in the application's main function and the handling of event received in the callback.
This function will result in the application receiving the RSSI via a @ref M2M_WIFI_RESP_CURRENT_RSSI event.
The code snippet demonstrates how the RSSI request is called in the application's main function and the handling of the event received in the callback.
References hif_send(), M2M_REQ_GROUP_WIFI, M2M_SUCCESS, M2M_WIFI_REQ_CURRENT_RSSI, and NULL.
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.
Asynchronous API to request the information of an access point discovered via scanning.
Synchronous call to read the AP information from the SCAN Result list.
[in] | index | Index for the requested result, the index range start from 0 till number of AP's found |
[in] | index | Index for the requested result, the index range start from 0 till number of AP's found |
The code snippet demonstrates an example of how the scan request is called from the application's main function and the handling of the events received in response.
[in] | index | Index for the requested result, the index range start from 0 till number of AP's found |
Synchronous call to read the AP information from the SCAN Result list with the given index. This function is expected to be called when the response events @ref M2M_WIFI_RESP_SCAN_RESULT or @ref M2M_WIFI_RESP_SCAN_DONE are received in the wi-fi callback function. The response information received can be obtained through the casting to the @ref tstrM2mWifiscanResult structure.
[in] | index | Index for the requested result, the index range start from 0 till number of AP's found. |
The code snippet demonstrates an example of how the scan request is called from the application's main function and the handling of the events received in response.
[in] | index | Index for the requested result, the index range start from 0 till number of AP's found |
This function allows the information of any discovered access point to be retrieved. When a scan is completed, the application is informed of the number of networks (access points) discovered. Calling this function with an index, N, will return the information for the Nth access point. The information will be returned to the application via a @ref M2M_WIFI_RESP_SCAN_RESULT event, and the response data may be obtained through casting the pointer (pvMsg) to @ref tstrM2mWifiscanResult.
[in] | index | Index for the requested result, the index range start from 0 till number of AP's found. |
The code snippet demonstrates an example of how the scan request is called from the application's main function and the handling of the events received in the response.
References hif_send(), M2M_REQ_GROUP_WIFI, M2M_SUCCESS, M2M_WIFI_REQ_SCAN_RESULT, NULL, and tstrM2mReqScanResult::u8Index.
Initialize the PS Server, The WINC support non secure communication with another WINC, (SERVER/CLIENT) through one byte command (probe request and probe response) without any connection setup.
Synchronous function to initialize the PS Server.
[in] | ch | Server listening channel |
The WINC supports non secure communication with another WINC, (SERVER/CLIENT) through one byte command (probe request and probe response) without any connection setup. The server mode can't be used with any other modes (STA/AP)
[in] | ch | Server listening channel |
References hif_send(), M2M_ERR, M2M_REQ_GROUP_WIFI, M2M_SUCCESS, M2M_WIFI_REQ_SERVER_INIT, NULL, and tstrM2mServerInit::u8Channel.
Asynchronous API to request the WINC IC to scan for networks.
Asynchronous API to request the WINC to scan for networks.
[in] | ch | RF Channel ID for SCAN operation. It should be set according to tenuM2mScanCh. With a value of M2M_WIFI_CH_ALL(255)), means to scan all channels. |
The code snippet demonstrates an example of how the scan request is called from the application's main function and the handling of the events received in response.
Scan statuses are delivered to the application via the Wi-Fi event callback (@ref tpfAppWifiCb) in three stages. The first step involves the event @ref M2M_WIFI_RESP_SCAN_DONE which, if successful, provides the number of detected networks (access points). The application must then read the list of access points via multiple calls to the asynchronous @ref m2m_wifi_req_scan_result API. For each call to this function, the application will receive (step three) the event @ref M2M_WIFI_RESP_SCAN_RESULT.
[in] | ch | RF Channel ID for SCAN operation. It should be set according to tenuM2mScanCh, with a value of M2M_WIFI_CH_ALL to scan all channels. |
The code snippet demonstrates an example of how the scan request is called from the application's main function and the handling of the events received in response.
Scan statuses are delivered to the application via the Wi-Fi event callback (@ref tpfAppWifiCb) in three stages. The first step involves the event @ref M2M_WIFI_RESP_SCAN_DONE which, if successful, provides the number of detected networks (access points). The application must then read the list of access points via multiple calls to the asynchronous @ref m2m_wifi_req_scan_result API. For each call to this function, the application will receive (step three) the event @ref M2M_WIFI_RESP_SCAN_RESULT.
[in] | ch | RF Channel ID for SCAN operation. It should be set according to tenuM2mScanCh, with a value of M2M_WIFI_CH_ALL to scan all channels. |
The code snippet demonstrates an example of how the scan request is called from the application's main function and the handling of the events received in response.
References gu8scanInProgress, hif_send(), M2M_ERR_INVALID_ARG, M2M_ERR_SCAN_IN_PROGRESS, M2M_REQ_GROUP_WIFI, M2M_SUCCESS, M2M_WIFI_CH_1, M2M_WIFI_CH_14, M2M_WIFI_CH_ALL, M2M_WIFI_REQ_SCAN, NULL, and tstrM2MScan::u8ChNum.
sint8 m2m_wifi_send_crl | ( | tstrTlsCrlInfo * | pCRL | ) |
Asynchronous API that notifies the WINC with the Certificate Revocation List.
[in] | pCRL | Pointer to the structure containing certificate revocation list details. |
References hif_send(), M2M_ERR_FAIL, M2M_REQ_DATA_PKT, M2M_REQ_GROUP_SSL, M2M_SSL_IND_CRL, and NULL.
API to add or remove a user-defined Information Element.
Asynchronous API to add or remove a user-defined Information Element.
Synchronous function to Add/Remove user-defined Information Element to the WIFIBeacon and Probe Response frames while chip mode is Access Point Mode.\n According to the information element layout shown bellow, if it is required to set new data for the information elements, pass in the buffer with the information according to the sizes and ordering defined bellow. However, if it's required to delete these IEs, fill the buffer with zeros.
[in] | pau8M2mCustInfoElement | Pointer to Buffer containing the IE to be sent. It is the application developer's responsibility to ensure on the correctness of the information element's ordering passed in. |
--------------- ---------- ---------- ------------------- -------- -------- ----------- ----------------------- | Byte[0] | Byte[1] | Byte[2] | Byte[3:length1+2] | ..... | Byte[n] | Byte[n+1] | Byte[n+2:lengthx+2] | |---------------|----------|----------|-------------------|-------- --------|-----------|---------------------| | #of all Bytes | IE1 ID | Length1 | Data1(Hex Coded) | ..... | IEx ID | Lengthx | Datax(Hex Coded) | --------------- ---------- ---------- ------------------- -------- -------- ----------- -----------------------
The example demonstrates how the information elements are set using this function.
This function allows the application to provide a custom Information Element to the WINC that will be included in all beacon and probe response frames, while in Access Point mode. If it is required to delete these IEs, fill the buffer with zeros.
[in] | pau8M2mCustInfoElement | Pointer to Buffer containing the IE to be used. It is the application developer's responsibility to ensure on the correctness of the information element's ordering passed in. If the pointer is null, this removes any current custom IE. If non-null, the pointer must reference data in the following format: |
--------------- ---------- ---------- ------------------- -------- -------- ----------- ----------------------- | Byte[0] | Byte[1] | Byte[2] | Byte[3:length1+2] | ..... | Byte[n] | Byte[n+1] | Byte[n+2:lengthx+2] | |---------------|----------|----------|-------------------|-------- --------|-----------|---------------------| | #of all Bytes | IE1 ID | Length1 | Data1(Hex Coded) | ..... | IEx ID | Lengthx | Datax(Hex Coded) | --------------- ---------- ---------- ------------------- -------- -------- ----------- -----------------------
The example demonstrates how the information elements are set using this function.
References hif_send(), M2M_CUST_IE_LEN_MAX, M2M_ERR_FAIL, M2M_REQ_DATA_PKT, M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_CUST_INFO_ELEMENT, and NULL.
Set the WILC1000 device name which is used as P2P device name.
Asynchronous API to set the Wi-Fi Direct "Device Name" of the WINC.
Set the WINC3400 device name which is used as P2P device name.
Asynchronous API to set the "Device Name" of the WINC IC.
Sets the WINC device name. The name string is used as a device name in DHCP hostname (option 12).
m2m_wifi_set_device_name Set the WILC device name which is to be used as a P2P device name.
[in] | pu8DeviceName | Buffer holding the device name. |
[in] | u8DeviceNameLength | Length of the device name. |
[in] | pu8DeviceName | Buffer holding the device name. |
[in] | u8DeviceNameLength | Length of the device name. Should not exceed the maximum device name's length M2M_DEVICE_NAME_MAX. |
Sets the WINC device name. The name string is used as a device name in DHCP hostname (option 12). If a device is not set through this function a default name is assigned. The default name is WINC-XX-YY, where XX and YY are the last 2 octets of the OTP MAC address. If OTP (eFuse) is programmed, then the default name is WINC-00-00.
[in] | pu8DeviceName | Buffer holding the device name. Device name is a null terminated C string. |
[in] | u8DeviceNameLength | Length of the device name. Should not exceed the maximum device name's length M2M_DEVICE_NAME_MAX (including null character). |
Sets the WINC device name. The name string is used as a device name in DHCP hostname (option 12). If a device is not set through this function a default name is assigned. The default name is WINC-XX-YY, where XX and YY are the last 2 octets of the OTP MAC address. If OTP (eFuse) is programmed, then the default name is WINC-00-00.
[in] | pu8DeviceName | Buffer holding the device name. Device name is a null terminated C string. |
[in] | u8DeviceNameLength | Length of the device name. Should not exceed the maximum device name's length M2M_DEVICE_NAME_MAX (including null character). |
References tstrM2MDeviceNameConfig::au8DeviceName, hif_send(), M2M_DEVICE_NAME_MAX, m2m_memcpy(), M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_DEVICE_NAME, and NULL.
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.
Asynchronous API to set Wi-Fi listen interval for power save operation.
API to set Wi-Fi listen interval for power save operation.
[in] | pstrM2mLsnInt | Structure holding the listen interval configurations. |
[in] | pstrM2mLsnInt | Structure holding the listen interval configurations. |
This is one of the two synchronous power-save setting functions that allow the host MCU application to tweak the system power consumption. Such tweaking can be done by modifying the Wi-Fi listen interval. The listen interval is how many beacon periods the station can sleep before it wakes up to receive data buffered in the AP. It is represented in units of AP beacon periods(100ms).
[in] | pstrM2mLsnInt | Structure holding the listen interval configuration. |
This is one of the two synchronous power-save setting functions that allow the host MCU application to tweak the system power consumption. Such tweaking can be done by modifying the Wi-Fi listen interval. The listen interval is how many beacon periods the station can sleep before it wakes up to receive data buffered in the AP. It is represented in units of AP beacon periods(100ms).
[in] | pstrM2mLsnInt | Structure holding the listen interval configuration. |
References hif_send(), M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_LSN_INT, and NULL.
set the ethernet receive buffer, should be called in the receive call back.
Synchronous function for setting or modifying the receiver buffer's length.
[in] | pvBuffer | Pointer to the ethernet receive buffer. |
[in] | u16BufferLen | Length of the buffer. |
Synchronous function for setting or modifying the receiver buffer's length. In the ETHERNET/bypass mode the application should define a callback of type @ref tpfAppEthCb, through which the application handles the received ethernet frames. It is through this callback function that the user can dynamically modify the length of the currently used receiver buffer.
[in] | pvBuffer | Pointer to Buffer to receive data. NULL pointer causes a negative error M2M_ERR_FAIL. |
[in] | u16BufferLen | Length of data to be received. Maximum length of data should not exceed the size defined by TCP/IP defined as SOCKET_BUFFER_MAX_LENGTH |
Synchronous function for setting or modifying the receiver buffer's length. In the ETHERNET/bypass mode the application should define a callback of type @ref tpfAppEthCb, through which the application handles the received ethernet frames. It is through this callback function that the user can dynamically modify the length of the currently used receiver buffer.
[in] | pvBuffer | Pointer to Buffer to receive data. NULL pointer causes a negative error M2M_ERR_FAIL. |
[in] | u16BufferLen | Length of data to be received. Maximum length of data should not exceed the size defined by TCP/IP defined as SOCKET_BUFFER_MAX_LENGTH |
References gau8ethRcvBuf, gu16ethRcvBufSize, M2M_ERR, M2M_ERR_FAIL, M2M_SUCCESS, and NULL.
Set the power saving mode for the WILC1000.
Synchronous API to set the power-save mode of the WINC.
Set the power saving mode for the WINC3400.
Synchronous API to set the power-save mode of the WINC IC.
Set the power saving mode for the WINC1500.
[in] | PsTyp | Desired power saving mode. Supported types are defined in tenuPowerSaveModes. |
[in] | BcastEn | Broadcast reception enable flag. If it is 1, the WILC1000 must be awake each DTIM Beacon for receiving Broadcast traffic. If it is 0, the WILC1000 will not wakeup at the DTIM Beacon, but its wakeup depends only on the the configured Listen Interval. |
[in] | PsTyp | Desired power saving mode. Supported types are defined in tenuPowerSaveModes. |
[in] | BcastEn | Broadcast reception enable flag. If it is 1, the WILC1000 must be awake each DTIM beacon for receiving broadcast traffic. If it is 0, the WILC1000 will not wakeup at the DTIM beacon, but its wakeup depends only on the the configured Listen Interval. |
[in] | PsTyp | Desired power saving mode. Supported types are defined in tenuPowerSaveModes. |
[in] | BcastEn | Broadcast reception enable flag. If it is 1, the WINC1500 must be awake each DTIM Beacon for receiving Broadcast traffic. If it is 0, the WINC1500 will not wakeup at the DTIM Beacon, but its wakeup depends only on the the configured Listen Interval. |
This is one of the two synchronous power-save setting functions that allow the host MCU application to tweak the system power consumption. Such tweaking can be done through one of two ways: - 1) Changing the power save mode, to one of the allowed power save modes (see @ref tenuPowerSaveModes). This is done by setting the first parameter. - 2) Configuring DTIM monitoring: Configuring beacon monitoring parameters by enabling or disabling the reception of broadcast/multicast data. This is done by setting the second parameter.
[in] | PsTyp | Desired power saving mode. Supported types are enumerated in tenuPowerSaveModes. |
[in] | BcastEn | Broadcast reception enable flag. If it is 1, the WINC will be awake for each DTIM beacon in order to check for and receive broadcast traffic. If it is 0, the WINC will ignore broadcast traffic. Through this flag the WINC will not wakeup at the DTIM beacon, but instead it will wakeup only based on the configured Listen Interval. |
[in] | PsTyp | Desired power saving mode. Supported types are defined in tenuPowerSaveModes. |
[in] | BcastEn | Broadcast reception enable flag. If it is 1, the WINC3400 must be awake each DTIM Beacon for receiving Broadcast traffic. If it is 0, the WINC3400 will not wakeup at the DTIM Beacon, but its wakeup depends only on the the configured Listen Interval. |
This is one of the two synchronous power-save setting functions that allow the host MCU application to tweak the system power consumption. Such tweaking can be done through one of two ways: - 1) Changing the power save mode, to one of the allowed power save modes (see @ref tenuPowerSaveModes). This is done by setting the first parameter. - 2) Configuring DTIM monitoring: Configuring beacon monitoring parameters by enabling or disabling the reception of broadcast/multicast data. This is done by setting the second parameter.
[in] | PsTyp | Desired power saving mode. Supported types are enumerated in tenuPowerSaveModes. |
[in] | BcastEn | Broadcast reception enable flag. If set to 1, the WINC will wake for each DTIM beacon to ensure broadcast traffic can be received. If set to 0, the WINC will not wakeup at the DTIM beacon, ignoring broadcast traffic, instead it will wake every N beacon periods, as per the negotiated Listen Interval. |
References hif_send(), hif_set_sleep_mode(), M2M_INFO, M2M_REQ_GROUP_WIFI, M2M_SUCCESS, M2M_WIFI_REQ_SLEEP, NULL, tstrM2mPsType::u8BcastEn, and tstrM2mPsType::u8PsType.
set the TX power
Set the TX power tenuM2mTxPwrLevel.
set the TX power tenuM2mTxPwrLevel
[in] | u8TxPwrLevel | TX power ppa to one of these values: 0dBm, 3dBm, 6dBm, 9dBm, 12dBm, 15dBm, 18dBm. Other values between these steps will be floored to the nearest supported level. A maximum level might be enforced by the firmware to comply to RF regulations |
[in] | u8TxPwrLevel | change the TX power tenuM2mTxPwrLevel |
[in] | u8TxPwrLevel | Change the TX power based on the enumeration tenuM2mTxPwrLevel. |
[in] | u8TxPwrLevel | change the TX power tenuM2mTxPwrLevel |
[in] | u8TxPwrLevel | Change the TX power based on the enumeration tenuM2mTxPwrLevel. |
References hif_send(), M2M_REQ_GROUP_WIFI, M2M_SUCCESS, M2M_WIFI_REQ_SET_TX_POWER, NULL, and tstrM2mTxPwrLevel::u8TxPwrLevel.
Asynchronous API to engage the WINC IC's Wi-Fi Protected Setup (enrollee) function.
Asynchronous API to engage the WINC Wi-Fi Protected Setup (enrollee) function.
[in] | u8TriggerType | WPS Trigger method. Could be:
|
[in] | pcPinNumber | PIN number for WPS PIN method. It is not used if the trigger type is WPS_PBC_TRIGGER. It must follow the rules stated by the WPS Standard. |
The code snippet shows an example of how wifi wps is triggered .
This function is called for the WINC to enter the WPS (Wi-Fi Protected Setup) mode. The result is passed to the Wi-Fi notification callback with the event @ref M2M_WIFI_REQ_WPS.
[in] | u8TriggerType | WPS Trigger method. This may be:
|
[in] | pcPinNumber | PIN number for WPS PIN method. It is not used if the trigger type is WPS_PBC_TRIGGER. It must follow the rules stated by the WPS standard. |
The code snippet shows an example of how wi-fi WPS is triggered .
This function can be called to make the WINC enter WPS (Wi-Fi Protected Setup) mode. The result is passed to the Wi-Fi notification callback with the event @ref M2M_WIFI_REQ_WPS.
[in] | u8TriggerType | WPS Trigger method. This may be:
|
[in] | pcPinNumber | Valid only if the u8TriggerType is WPS_PIN_TRIGGER, this parameter contains the PIN number. The number must follow the format as given in the WSC1.0 specification. |
The code snippet shows an example of how wi-fi WPS is triggered .
References tstrM2MWPSConnect::acPinNumber, gu8scanInProgress, hif_send(), m2m_memcpy(), M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_WPS, NULL, tstrM2MWPSConnect::u8TriggerType, and WPS_PIN_TRIGGER.
sint8 m2m_wifi_wps_disable | ( | void | ) |
Disable the WILC WPS operation.
Asynchronous API that disables Wi-Fi Protected Setup mode in the WINC.
Stops the ongoing WPS session.
References hif_send(), M2M_REQ_GROUP_WIFI, M2M_SUCCESS, M2M_WIFI_REQ_DISABLE_WPS, and NULL.
|
static |
Referenced by app_wifi_init(), m2m_wifi_cb(), m2m_wifi_init_start(), and m2m_wifi_set_receive_buffer().
|
static |
Referenced by m2m_wifi_cb(), and m2m_wifi_init_start().
|
static |
|
static |
Referenced by m2m_wifi_cb(), m2m_wifi_init_start(), and m2m_wifi_set_receive_buffer().
|
static |
|
static |
Referenced by m2m_wifi_cb(), and m2m_wifi_get_num_ap_found().
|
static |
|
static |
Referenced by m2m_wifi_deinit(), m2m_wifi_download_mode(), m2m_wifi_get_state(), m2m_wifi_init_hold(), and m2m_wifi_init_start().