Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Initialization

         Here are listed all the functions that implement the Wlan Initialization APIs.

Functions

sint8 m2m_wifi_deinit (void *arg)
 De-initialize the WINC driver and host interface. More...
 
sint8 m2m_wifi_download_mode ()
 Prepares the WINC board before downloading any data (Firmware, Certificates, etc). More...
 
uint8 m2m_wifi_get_state (void)
 Get the wifi state. More...
 
sint8 m2m_wifi_init (tstrWifiInitParam *pWifiInitParam)
 Synchronous API to initialize the WINC driver. More...
 
sint8 m2m_wifi_init_hold ()
 First part of m2m_wifi_init, up to the point of initializing SPI for flash access. More...
 
sint8 m2m_wifi_init_start (tstrWifiInitParam *pWifiInitParam)
 Second part of m2m_wifi_init, continuing from where m2m_wifi_init_hold left off. More...
 
sint8 m2m_wifi_reinit (tstrWifiInitParam *pWifiInitParam)
 De-initialize and then initialize wifi. Resets the WINC. More...
 
sint8 m2m_wifi_reinit_hold (void)
 First part of m2m_wifi_reinit, up to the point of initializing SPI for flash access. More...
 
sint8 m2m_wifi_reinit_start (tstrWifiInitParam *pWifiInitParam)
 Second part of m2m_wifi_reinit, continuing from where m2m_wifi_reinit_hold left off. More...
 

NMI_API sint8 m2m_wifi_deinit ( void *  arg)

De-initialize the WINC driver and host interface.

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. 
Parameters
[in]argOpaque argument, not used in current implementation. Application should use null.
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC, and a negative value otherwise.
Note
This function must be called at the de-initialization stage of the application. Generally this function should be the last function before switching off the chip and it should be followed only by nm_bsp_deinit function call. Every function call of m2m_wifi_init should be matched with a call to m2m_wifi_deinit.
See Also
nm_bsp_deinit m2m_wifi_init m2m_wifi_init_hold m2m_wifi_download_mode

References gu8WifiState, hif_deinit(), M2M_SUCCESS, nm_drv_deinit(), NULL, and WIFI_STATE_DEINIT.

Referenced by burn_certificates(), m2m_wifi_reinit_hold(), and wifi_ap_provision().

NMI_API void m2m_wifi_download_mode ( void  )

Prepares the WINC board before downloading any data (Firmware, Certificates, etc).

This function should be called before attempting to download any data to the WINC board.
Performs the appropriate WINC driver initialization, this includes bus initialization,
interrupt enabling and it halts the chip to allow for the firmware downloads. Firmware
can be downloaded through a number of interfaces, UART, I2C and SPI.
Precondition
Prior to call m2m_wifi_download_mode, the Application should ensure that the wifi is not initialized. This can be done by calling m2m_wifi_get_state and in case the wifi state differs from WIFI_STATE_DEINIT, a m2m_wifi_deinit needs to be issued.
Returns
The function returns M2M_SUCCESS for successful operations and a negative value otherwise.

References enable_interrupts(), gu8WifiState, M2M_SUCCESS, nm_drv_init_download_mode(), and WIFI_STATE_INIT.

Referenced by burn_certificates(), and enter_wifi_firmware_download().

NMI_API uint8 m2m_wifi_get_state ( void  )

Get the wifi state.

Returns
The function returns the current wifi state (see tenuWifiState for the possible states).
Note
Check the WINC state. See tenuWifiState for possible states.
WIFI_STATE_INIT state represents WINC initialized but not started, this is a suitable state for safe flash access.
See Also
m2m_wifi_init m2m_wifi_download_mode

References gu8WifiState.

Referenced by m2m_ota_host_file_read_spi().

NMI_API sint8 m2m_wifi_init ( tstrWifiInitParam pWifiInitParam)

Synchronous API to initialize the WINC driver.

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.
Parameters
[in]pWifiInitParamThis 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).
Returns
The function returns M2M_SUCCESS for successful operations and a negative value otherwise.
Precondition
Prior to this function call, The application should initialize the BSP using nm_bsp_init. Also, application users must provide a call back function responsible for receiving all the wi-fi events that are received on the M2M_WIFI layer.
Warning
Failure to successfully complete indicates that the driver could not be initialized and a fatal error will prevent the application from proceeding, proper error handling should be implemented by the application.
See Also
m2m_wifi_deinit m2m_wifi_init_hold m2m_wifi_init_start tstrWifiInitParam tenuM2mStaCmd tenuM2mStaCmd

References M2M_SUCCESS, m2m_wifi_init_hold(), and m2m_wifi_init_start().

Referenced by main(), and wifi_ap_provision().

NMI_API sint8 m2m_wifi_init_hold ( void  )

First part of m2m_wifi_init, up to the point of initializing SPI for flash access.

See Also
m2m_wifi_init m2m_wifi_init_start

References gu8WifiState, M2M_ERR_FAIL, M2M_SUCCESS, nm_drv_init_hold(), and WIFI_STATE_INIT.

Referenced by m2m_wifi_init(), and m2m_wifi_reinit_hold().

NMI_API sint8 m2m_wifi_reinit ( tstrWifiInitParam pWifiInitParam)

De-initialize and then initialize wifi. Resets the WINC.

Parameters
[in]pWifiInitParamThis is a pointer to a variable of type tstrWifiInitParam which contains pointers to the application WIFI layer callback function (see tpfAppWifiCb), monitoring mode callback (see tpfAppEthCb) and tstrEthInitParam structure (which contains initialization settings for bypass mode).
Note
m2m_wifi_reinit wraps a call to m2m_wifi_deinit and to m2m_wifi_init.
See Also
m2m_wifi_deinit m2m_wifi_init tstrWifiInitParam

References M2M_SUCCESS, m2m_wifi_reinit_hold(), and m2m_wifi_reinit_start().

NMI_API sint8 m2m_wifi_reinit_hold ( void  )

First part of m2m_wifi_reinit, up to the point of initializing SPI for flash access.

Note
m2m_wifi_reinit_hold wraps a call to m2m_wifi_deinit and to m2m_wifi_init_hold.
See Also
m2m_wifi_deinit m2m_wifi_reinit m2m_wifi_init_hold

References m2m_wifi_deinit(), m2m_wifi_init_hold(), and NULL.

Referenced by m2m_wifi_reinit().

NMI_API sint8 m2m_wifi_reinit_start ( tstrWifiInitParam pWifiInitParam)

Second part of m2m_wifi_reinit, continuing from where m2m_wifi_reinit_hold left off.

Parameters
[in]pWifiInitParamThis is a pointer to the tstrWifiInitParam structure which contains pointers to the application WIFI layer callback function (see tpfAppWifiCb), monitoring mode callback (see tpfAppEthCb) and tstrEthInitParam structure (which contains initialization settings for bypass mode).
See Also
m2m_wifi_reinit m2m_wifi_init_start tstrWifiInitParam

References m2m_wifi_init_start().

Referenced by m2m_wifi_reinit().