Microchip® Advanced Software Framework

winc1500/host_drv/driver/source/m2m_hif.h File Reference

This module contains M2M host interface APIs implementation.

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

#include "common/include/nm_common.h"

Data Structures

struct  tstrHifHdr
 Structure to hold HIF header. More...
 

Macros

#define M2M_HIF_HDR_OFFSET   (sizeof(tstrHifHdr) + 4)
 
#define M2M_HIF_MAX_PACKET_SIZE   (1600 - 4)
 

Typedefs

typedef void(* tpfHifCallBack )(uint8 u8OpCode, uint16 u16DataSize, uint32 u32Addr)
 

Functions

NMI_API sint8 hif_chip_sleep (void)
 To make the chip sleep. More...
 
NMI_API sint8 hif_chip_sleep_sc (void)
 To clear the chip sleep but keep the chip sleep. More...
 
NMI_API sint8 hif_chip_wake (void)
 To Wakeup the chip. More...
 
NMI_API sint8 hif_deinit (void *arg)
 To Deinitialize HIF layer. More...
 
NMI_API uint8 hif_get_sleep_mode (void)
 Get the sleep mode of the HIF layer. More...
 
NMI_API sint8 hif_handle_isr (void)
 
    Handle interrupt received from NMC1500 firmware.
More...
 
NMI_API sint8 hif_init (void *arg)
 To initialize HIF layer. More...
 
NMI_API sint8 hif_receive (uint32 u32Addr, uint8 *pu8Buf, uint16 u16Sz, uint8 isDone)
 
NMI_API sint8 hif_register_cb (uint8 u8Grp, tpfHifCallBack fn)
 
NMI_API sint8 hif_send (uint8 u8Gid, uint8 u8Opcode, uint8 *pu8CtrlBuf, uint16 u16CtrlBufSize, uint8 *pu8DataBuf, uint16 u16DataSize, uint16 u16DataOffset)
 Send packet using host interface. More...
 
NMI_API void hif_set_sleep_mode (uint8 u8Pstype)
 Set the sleep mode of the HIF layer. More...
 
NMI_API void hif_yield (void)
 Yields control from interrupt event handler. More...
 

#define M2M_HIF_HDR_OFFSET   (sizeof(tstrHifHdr) + 4)
#define M2M_HIF_MAX_PACKET_SIZE   (1600 - 4)

< Include depends on UNO Board is used or not Maximum size of the buffer could be transferred between Host and Firmware.

typedef void(* tpfHifCallBack)(uint8 u8OpCode, uint16 u16DataSize, uint32 u32Addr)

NMI_API sint8 hif_chip_sleep ( void  )

To make the chip sleep.

        To make the chip sleep.
Returns
The function shall return ZERO for successful operation and a negative value otherwise.

References chip_sleep(), M2M_NO_PS, M2M_SUCCESS, ret, tstrHifContext::u8ChipMode, and tstrHifContext::u8ChipSleep.

Referenced by gpio_ioctl(), hif_init(), hif_send(), m2m_ota_get_firmware_version(), m2m_wifi_get_firmware_version(), m2m_wifi_get_mac_address(), and m2m_wifi_get_otp_mac_address().

NMI_API sint8 hif_chip_sleep_sc ( void  )

To clear the chip sleep but keep the chip sleep.

        To clear the chip count only but keep the chip awake
Returns
The function shall return ZERO for successful operation and a negative value otherwise.

References M2M_SUCCESS, and tstrHifContext::u8ChipSleep.

NMI_API sint8 hif_chip_wake ( void  )

To Wakeup the chip.

    To Wakeup the chip.
Returns
The function shall return ZERO for successful operation and a negative value otherwise.

References chip_wake(), M2M_NO_PS, M2M_SUCCESS, ret, tstrHifContext::u8ChipMode, tstrHifContext::u8ChipSleep, and tstrHifContext::u8HifRXDone.

Referenced by gpio_ioctl(), hif_deinit(), hif_send(), m2m_ota_get_firmware_version(), m2m_wifi_get_firmware_version(), m2m_wifi_get_mac_address(), and m2m_wifi_get_otp_mac_address().

NMI_API sint8 hif_deinit ( void *  arg)

To Deinitialize HIF layer.

To De-initialize HIF layer.

        To Deinitialize HIF layer.
Parameters
[in]argPointer to the arguments.
Returns
The function shall return ZERO for successful operation and a negative value otherwise.
Parameters
[in]argPointer to the arguments.
Returns
The function shall return ZERO for successful operation and a negative value otherwise.

References hif_chip_wake(), m2m_memset(), M2M_SUCCESS, and ret.

Referenced by m2m_wifi_deinit().

NMI_API uint8 hif_get_sleep_mode ( void  )

Get the sleep mode of the HIF layer.

Returns
The function SHALL return the sleep mode of the HIF layer.

References tstrHifContext::u8ChipMode.

Referenced by m2m_wifi_get_sleep_mode(), and m2m_wifi_request_sleep().

NMI_API sint8 hif_handle_isr ( void  )

    Handle interrupt received from NMC1500 firmware.

Handle interrupt received from NMC1500 firmware.

Returns
The function SHALL return 0 for success and a negative value otherwise.

References hif_isr(), M2M_ERR, M2M_SUCCESS, nm_bsp_interrupt_ctrl(), ret, tstrHifContext::u8Interrupt, and tstrHifContext::u8Yield.

Referenced by m2m_wifi_handle_events().

NMI_API sint8 hif_init ( void *  arg)

To initialize HIF layer.

        To initialize HIF layer.
Parameters
[in]argPointer to the arguments.
Returns
The function shall return ZERO for successful operation and a negative value otherwise.
Parameters
[in]argPointer to the arguments.
Returns
The function shall return ZERO for successful operation and a negative value otherwise.

References hif_chip_sleep(), hif_register_cb(), isr(), m2m_hif_cb(), m2m_memset(), M2M_REQ_GROUP_HIF, M2M_SUCCESS, nm_bsp_register_isr(), and ret.

Referenced by m2m_wifi_init_start().

NMI_API sint8 hif_send ( uint8  u8Gid,
uint8  u8Opcode,
uint8 pu8CtrlBuf,
uint16  u16CtrlBufSize,
uint8 pu8DataBuf,
uint16  u16DataSize,
uint16  u16DataOffset 
)

Send packet using host interface.

Parameters
[in]u8GidGroup ID.
[in]u8OpcodeOperation ID.
[in]pu8CtrlBufPointer to the Control buffer.
[in]u16CtrlBufSizeControl buffer size.
[in]u16DataOffsetPacket Data offset.
[in]pu8DataBufPacket buffer Allocated by the caller.
[in]u16DataSizePacket buffer size (including the HIF header).
Returns
The function shall return M2M_SUCCESS for successful operation and a negative value otherwise.
Parameters
[in]u8GidGroup ID.
[in]u8OpcodeOperation ID.
[in]pu8CtrlBufPointer to the Control buffer.
[in]u16CtrlBufSizeControl buffer size.
[in]u16DataOffsetPacket Data offset.
[in]pu8DataBufPacket buffer Allocated by the caller.
[in]u16DataSizePacket buffer size (including the HIF header).
Returns
The function shall return ZERO for successful operation and a negative value otherwise.

References cnt, hif_check_code(), hif_chip_sleep(), hif_chip_sleep_sc(), hif_chip_wake(), INTERRUPT_CORTUS_1_3000D0, INTERRUPT_CORTUS_2_3000D0, ISNMC3400, M2M_DBG, M2M_ERR, M2M_ERR_MEM_ALLOC, M2M_ERR_SEND, M2M_HIF_HDR_OFFSET, M2M_HIF_MAX_PACKET_SIZE, M2M_INFO, M2M_REQ_GROUP_IP, M2M_SUCCESS, NBIT1, NBIT2, NBIT3, NBIT7, NM_BSP_B_L_16, nm_bsp_sleep(), nm_read_reg_with_ret(), nm_write_block(), nm_write_reg(), nmi_get_chipid(), NMI_STATE_REG, NULL, ret, tstrHifHdr::u16Length, tstrHifHdr::u8Gid, tstrHifHdr::u8Opcode, WIFI_HOST_RCV_CTRL_2, WIFI_HOST_RCV_CTRL_3, and WIFI_HOST_RCV_CTRL_4.

Referenced by m2m_ota_abort(), m2m_ota_host_file_erase(), m2m_ota_host_file_get(), m2m_ota_host_file_read_hif(), m2m_ota_init(), m2m_ota_notif_check_for_update(), m2m_ota_notif_sched(), m2m_ota_notif_set_url(), m2m_ota_rollback(), m2m_ota_start_update(), m2m_ota_switch_firmware(), m2m_ssl_handshake_rsp(), m2m_ssl_send_certs_to_winc(), m2m_ssl_set_active_ciphersuites(), m2m_wifi_ble_api_send(), m2m_wifi_ble_set_gain_table(), m2m_wifi_conf_auto_rate(), m2m_wifi_configure_sntp(), m2m_wifi_connect_1x_mschap2(), m2m_wifi_connect_1x_tls(), m2m_wifi_connect_open(), m2m_wifi_connect_psk(), m2m_wifi_connect_wep(), m2m_wifi_default_connect(), m2m_wifi_delete_sc(), m2m_wifi_disable_ap(), m2m_wifi_disable_roaming(), m2m_wifi_disconnect(), m2m_wifi_enable_ap_ext(), m2m_wifi_enable_dhcp(), m2m_wifi_enable_firmware_logs(), m2m_wifi_enable_roaming(), m2m_wifi_enable_sntp(), m2m_wifi_enable_XO_during_sleep(), m2m_wifi_get_connection_info(), m2m_wifi_get_system_time(), m2m_wifi_p2p(), m2m_wifi_p2p_disconnect(), m2m_wifi_prng_get_random_bytes(), m2m_wifi_req_client_ctrl(), m2m_wifi_req_curr_rssi(), m2m_wifi_req_restrict_ble(), m2m_wifi_req_scan_result(), m2m_wifi_req_server_init(), m2m_wifi_req_unrestrict_ble(), m2m_wifi_request_scan(), m2m_wifi_request_scan_passive(), m2m_wifi_request_scan_ssid_list(), m2m_wifi_request_sleep(), m2m_wifi_send_crl(), m2m_wifi_send_ethernet_pkt(), m2m_wifi_set_battery_voltage(), m2m_wifi_set_cust_InfoElement(), m2m_wifi_set_device_name(), m2m_wifi_set_gain_table_idx(), m2m_wifi_set_gains(), m2m_wifi_set_lsn_int(), m2m_wifi_set_mac_address(), m2m_wifi_set_power_profile(), m2m_wifi_set_scan_options(), m2m_wifi_set_scan_region(), m2m_wifi_set_sleep_mode(), m2m_wifi_set_static_ip(), m2m_wifi_set_stop_scan_on_first(), m2m_wifi_set_system_time(), m2m_wifi_set_tx_power(), m2m_wifi_start_provision_mode_ext(), m2m_wifi_stop_provision_mode(), m2m_wifi_wps(), and m2m_wifi_wps_disable().

NMI_API void hif_set_sleep_mode ( uint8  u8Pstype)

Set the sleep mode of the HIF layer.

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

References tstrHifContext::u8ChipMode.

Referenced by m2m_wifi_set_sleep_mode().

NMI_API void hif_yield ( void  )

Yields control from interrupt event handler.

    Yields control from interrupt event handler.

References tstrHifContext::u8Yield.

Referenced by m2m_wifi_yield().