mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Update WINC1500 driver to 19.4.4
This commit is contained in:
parent
b8e338138c
commit
dae73f6250
@ -2,7 +2,7 @@
|
|||||||
*
|
*
|
||||||
* \file
|
* \file
|
||||||
*
|
*
|
||||||
* \brief This module contains common APIs declarations.
|
* \brief WINC Driver Common API Declarations.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015 Atmel Corporation. All rights reserved.
|
* Copyright (c) 2015 Atmel Corporation. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -139,16 +139,6 @@ Invalid argument
|
|||||||
#define BYTE_3(word) ((uint8)(((word) >> 0 ) & 0x000000FFUL))
|
#define BYTE_3(word) ((uint8)(((word) >> 0 ) & 0x000000FFUL))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
typedef enum{
|
|
||||||
M2M_REQ_GRP_MAIN = 0, M2M_REQ_GRP_WIFI, M2M_REQ_GRP_IP, M2M_REQ_GRP_HIF, M2M_REQ_GRP_OTA
|
|
||||||
}tenuM2mReqGrp;
|
|
||||||
|
|
||||||
|
|
||||||
typedef enum{
|
|
||||||
M2M_REQ_CONFIG_PKT,
|
|
||||||
M2M_REQ_DATA_PKT = NBIT7
|
|
||||||
}tenuM2mReqPkt;
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@ -57,21 +57,21 @@
|
|||||||
#define M2M_LOG_REQ 3
|
#define M2M_LOG_REQ 3
|
||||||
#define M2M_LOG_DBG 4
|
#define M2M_LOG_DBG 4
|
||||||
|
|
||||||
#if (defined __APP_APS3_CORTUS__)
|
#if (defined __APS3_CORTUS__)
|
||||||
#define M2M_LOG_LEVEL M2M_LOG_ERROR
|
#define M2M_LOG_LEVEL M2M_LOG_ERROR
|
||||||
#else
|
#else
|
||||||
#define M2M_LOG_LEVEL M2M_LOG_REQ
|
#define M2M_LOG_LEVEL M2M_LOG_REQ
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**/
|
|
||||||
#if !((defined __MSP430FR5739)||(defined __MCF964548__))
|
|
||||||
|
|
||||||
#define M2M_ERR(...)
|
#define M2M_ERR(...)
|
||||||
#define M2M_INFO(...)
|
#define M2M_INFO(...)
|
||||||
#define M2M_REQ(...)
|
#define M2M_REQ(...)
|
||||||
#define M2M_DBG(...)
|
#define M2M_DBG(...)
|
||||||
|
#define M2M_PRINT(...)
|
||||||
|
|
||||||
#if (CONF_WINC_DEBUG == 1)
|
#if (CONF_WINC_DEBUG == 1)
|
||||||
|
#undef M2M_PRINT
|
||||||
#define M2M_PRINT(...) do{CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
|
#define M2M_PRINT(...) do{CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
|
||||||
#if (M2M_LOG_LEVEL >= M2M_LOG_ERROR)
|
#if (M2M_LOG_LEVEL >= M2M_LOG_ERROR)
|
||||||
#undef M2M_ERR
|
#undef M2M_ERR
|
||||||
@ -85,41 +85,11 @@
|
|||||||
#if (M2M_LOG_LEVEL >= M2M_LOG_DBG)
|
#if (M2M_LOG_LEVEL >= M2M_LOG_DBG)
|
||||||
#undef M2M_DBG
|
#undef M2M_DBG
|
||||||
#define M2M_DBG(...) do{CONF_WINC_PRINTF("(APP)(DBG)[%s][%d]",__FUNCTION__,__LINE__); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
|
#define M2M_DBG(...) do{CONF_WINC_PRINTF("(APP)(DBG)[%s][%d]",__FUNCTION__,__LINE__); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
|
||||||
#endif
|
#endif /*M2M_LOG_DBG*/
|
||||||
#endif
|
#endif /*M2M_LOG_REQ*/
|
||||||
#endif
|
#endif /*M2M_LOG_INFO*/
|
||||||
#endif
|
#endif /*M2M_LOG_ERROR*/
|
||||||
#else
|
#endif /*CONF_WINC_DEBUG */
|
||||||
#define M2M_ERR(...)
|
|
||||||
#define M2M_DBG(...)
|
|
||||||
#define M2M_REQ(...)
|
|
||||||
#define M2M_INFO(...)
|
|
||||||
#define M2M_PRINT(...)
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#if (!defined __MCF964548__)||(!defined __SAMD21J18A__)
|
|
||||||
static void M2M_ERR(const char *_format, ...) //__attribute__ ((__format__ (M2M_ERR, 1, 2)))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
static void M2M_DBG(const char *_format, ...) //__attribute__ ((__format__ (M2M_DBG, 1, 2)))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
static void M2M_REQ(const char *_format, ...) //__attribute__ ((__format__ (M2M_DBG, 1, 2)))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
static void M2M_INFO(const char *_format, ...) // __attribute__ ((__format__ (M2M_INFO, 1, 2)))
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
static void M2M_PRINT(const char *_format, ...) // __attribute__ ((__format__ (M2M_INFO, 1, 2)))
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
static void CONF_WINC_PRINTF(const char *_format, ...)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
#endif /* _NM_DEBUG_H_ */
|
#endif /* _NM_DEBUG_H_ */
|
||||||
@ -2,7 +2,7 @@
|
|||||||
*
|
*
|
||||||
* \file
|
* \file
|
||||||
*
|
*
|
||||||
* \brief NMC1500 Peripherals Application Interface.
|
* \brief WINC ATE Test Driver Interface.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015 Atmel Corporation. All rights reserved.
|
* Copyright (c) 2015 Atmel Corporation. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -209,6 +209,15 @@ typedef enum {
|
|||||||
M2M_ATE_TX_MODE_CW = 0x01,
|
M2M_ATE_TX_MODE_CW = 0x01,
|
||||||
}tenuM2mAteTxMode;
|
}tenuM2mAteTxMode;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
*@enum tenuM2mAteRxPwrMode
|
||||||
|
*@brief Used to define type of RX mode either high power or low power
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
M2M_ATE_RX_PWR_HIGH = 0x00,
|
||||||
|
M2M_ATE_RX_PWR_LOW = 0x01,
|
||||||
|
}tenuM2mAteRxPwrMode;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*@enum tenuM2mAteChannels
|
*@enum tenuM2mAteChannels
|
||||||
*@brief Available channels for TX and RX
|
*@brief Available channels for TX and RX
|
||||||
@ -246,6 +255,16 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
} tstrM2mAteRxStatus;
|
} tstrM2mAteRxStatus;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
*@struct tstrM2mAteRxStatus
|
||||||
|
*@brief Used to save statistics of RX case
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
uint8 u8RxPwrMode;
|
||||||
|
/*!< RX power mode review tenuM2mAteRxPwrMode
|
||||||
|
*/
|
||||||
|
} tstrM2mAteInit;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*@struct tstrM2mAteTx
|
*@struct tstrM2mAteTx
|
||||||
*@brief Used as data source in case of enabling TX test case
|
*@brief Used as data source in case of enabling TX test case
|
||||||
@ -345,6 +364,19 @@ FUNCTION PROTOTYPES
|
|||||||
*/
|
*/
|
||||||
sint8 m2m_ate_init(void);
|
sint8 m2m_ate_init(void);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@fn \
|
||||||
|
sint8 m2m_ate_init(tstrM2mAteInit *pstrInit);
|
||||||
|
|
||||||
|
@brief
|
||||||
|
This function used to download ATE firmware from flash and start it
|
||||||
|
|
||||||
|
@return
|
||||||
|
The function SHALL return 0 for success and a negative value otherwise.
|
||||||
|
*/
|
||||||
|
sint8 m2m_ate_init_param(tstrM2mAteInit *pstrInit);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@fn \
|
@fn \
|
||||||
sint8 m2m_ate_deinit(void);
|
sint8 m2m_ate_deinit(void);
|
||||||
|
|||||||
245
src/winc1500/include/driver/include/m2m_crypto.h
Normal file
245
src/winc1500/include/driver/include/m2m_crypto.h
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \file
|
||||||
|
*
|
||||||
|
* \brief WINC Crypto Application Interface.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Atmel Corporation. All rights reserved.
|
||||||
|
*
|
||||||
|
* \asf_license_start
|
||||||
|
*
|
||||||
|
* \page License
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* 3. The name of Atmel may not be used to endorse or promote products derived
|
||||||
|
* from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||||
|
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* \asf_license_stop
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __M2M_CRYPTO_H__
|
||||||
|
#define __M2M_CRYPTO_H__
|
||||||
|
|
||||||
|
|
||||||
|
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
||||||
|
INCLUDES
|
||||||
|
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "common/include/nm_common.h"
|
||||||
|
#include "driver/include/m2m_types.h"
|
||||||
|
#include "driver/include/m2m_hif.h"
|
||||||
|
|
||||||
|
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
||||||
|
MACROS
|
||||||
|
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
|
||||||
|
#define M2M_MAX_RSA_LEN (256)
|
||||||
|
#define M2M_SHA256_DIGEST_LEN 32
|
||||||
|
#define M2M_SHA256_MAX_DATA (M2M_BUFFER_MAX_SIZE - M2M_SHA256_CONTEXT_BUFF_LEN - M2M_HIF_HDR_OFFSET)
|
||||||
|
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
||||||
|
DATA TYPES
|
||||||
|
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@struct \
|
||||||
|
tstrM2mSha256Ctxt
|
||||||
|
|
||||||
|
@brief
|
||||||
|
SHA256 context data
|
||||||
|
*/
|
||||||
|
typedef struct sha256ctxt{
|
||||||
|
uint32 au32Sha256CtxtBuff[M2M_SHA256_CONTEXT_BUFF_LEN/sizeof(uint32)];
|
||||||
|
} tstrM2mSha256Ctxt;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@enum \
|
||||||
|
tenuRsaSignStatus
|
||||||
|
|
||||||
|
@brief
|
||||||
|
RSA Signature status: pass or fail.
|
||||||
|
*/
|
||||||
|
typedef enum{
|
||||||
|
M2M_RSA_SIGN_OK,
|
||||||
|
M2M_RSA_SIGN_FAIL
|
||||||
|
} tenuRsaSignStatus;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@typedef \
|
||||||
|
tpfAppCryproCb
|
||||||
|
|
||||||
|
@brief
|
||||||
|
@param [in] u8MsgType
|
||||||
|
|
||||||
|
@param [in] pvMsg
|
||||||
|
A pointer to a buffer containing the notification parameters (if any). It should be
|
||||||
|
Casted to the correct data type corresponding to the notification type.
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
typedef void (*tpfAppCryproCb) (uint8 u8MsgType,void * pvResp, void * pvMsg);
|
||||||
|
|
||||||
|
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
||||||
|
FUNCTION PROTOTYPES
|
||||||
|
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
/*!
|
||||||
|
@fn \
|
||||||
|
sint8 m2m_crypto_init();
|
||||||
|
|
||||||
|
@brief crypto initialization
|
||||||
|
|
||||||
|
@param[in] pfAppCryproCb
|
||||||
|
|
||||||
|
*/
|
||||||
|
sint8 m2m_crypto_init(tpfAppCryproCb pfAppCryproCb);
|
||||||
|
/*!
|
||||||
|
@fn \
|
||||||
|
sint8 m2m_sha256_hash_init(tstrM2mSha256Ctxt *psha256Ctxt);
|
||||||
|
|
||||||
|
@brief SHA256 hash initialization
|
||||||
|
|
||||||
|
@param[in] psha256Ctxt
|
||||||
|
Pointer to a sha256 context allocated by the caller.
|
||||||
|
*/
|
||||||
|
sint8 m2m_crypto_sha256_hash_init(tstrM2mSha256Ctxt *psha256Ctxt);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@fn \
|
||||||
|
sint8 m2m_sha256_hash_update(tstrM2mSha256Ctxt *psha256Ctxt, uint8 *pu8Data, uint16 u16DataLength);
|
||||||
|
|
||||||
|
@brief SHA256 hash update
|
||||||
|
|
||||||
|
@param [in] psha256Ctxt
|
||||||
|
Pointer to the sha256 context.
|
||||||
|
|
||||||
|
@param [in] pu8Data
|
||||||
|
Buffer holding the data submitted to the hash.
|
||||||
|
|
||||||
|
@param [in] u16DataLength
|
||||||
|
Size of the data bufefr in bytes.
|
||||||
|
*/
|
||||||
|
sint8 m2m_crypto_sha256_hash_update(tstrM2mSha256Ctxt *psha256Ctxt, uint8 *pu8Data, uint16 u16DataLength);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@fn \
|
||||||
|
sint8 m2m_sha256_hash_finish(tstrM2mSha256Ctxt *psha256Ctxt, uint8 *pu8Sha256Digest);
|
||||||
|
|
||||||
|
@brief SHA256 hash finalization
|
||||||
|
|
||||||
|
@param[in] psha256Ctxt
|
||||||
|
Pointer to a sha256 context allocated by the caller.
|
||||||
|
|
||||||
|
@param [in] pu8Sha256Digest
|
||||||
|
Buffer allocated by the caller which will hold the resultant SHA256 Digest. It must be allocated no less than M2M_SHA256_DIGEST_LEN.
|
||||||
|
*/
|
||||||
|
sint8 m2m_crypto_sha256_hash_finish(tstrM2mSha256Ctxt *psha256Ctxt, uint8 *pu8Sha256Digest);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@fn \
|
||||||
|
sint8 m2m_rsa_sign_verify(uint8 *pu8N, uint16 u16NSize, uint8 *pu8E, uint16 u16ESize, uint8 *pu8SignedMsgHash, \
|
||||||
|
uint16 u16HashLength, uint8 *pu8RsaSignature);
|
||||||
|
|
||||||
|
@brief RSA Signature Verification
|
||||||
|
|
||||||
|
The function shall request the RSA Signature verification from the WINC Firmware for the given message. The signed message shall be
|
||||||
|
compressed to the corresponding hash algorithm before calling this function.
|
||||||
|
The hash type is identified by the given hash length. For example, if the hash length is 32 bytes, then it is SHA256.
|
||||||
|
|
||||||
|
@param[in] pu8N
|
||||||
|
RSA Key modulus n.
|
||||||
|
|
||||||
|
@param[in] u16NSize
|
||||||
|
Size of the RSA modulus n in bytes.
|
||||||
|
|
||||||
|
@param[in] pu8E
|
||||||
|
RSA public exponent.
|
||||||
|
|
||||||
|
@param[in] u16ESize
|
||||||
|
Size of the RSA public exponent in bytes.
|
||||||
|
|
||||||
|
@param[in] pu8SignedMsgHash
|
||||||
|
The hash digest of the signed message.
|
||||||
|
|
||||||
|
@param[in] u16HashLength
|
||||||
|
The length of the hash digest.
|
||||||
|
|
||||||
|
@param[out] pu8RsaSignature
|
||||||
|
Signature value to be verified.
|
||||||
|
*/
|
||||||
|
sint8 m2m_crypto_rsa_sign_verify(uint8 *pu8N, uint16 u16NSize, uint8 *pu8E, uint16 u16ESize, uint8 *pu8SignedMsgHash,
|
||||||
|
uint16 u16HashLength, uint8 *pu8RsaSignature);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@fn \
|
||||||
|
sint8 m2m_rsa_sign_gen(uint8 *pu8N, uint16 u16NSize, uint8 *pu8d, uint16 u16dSize, uint8 *pu8SignedMsgHash, \
|
||||||
|
uint16 u16HashLength, uint8 *pu8RsaSignature);
|
||||||
|
|
||||||
|
@brief RSA Signature Generation
|
||||||
|
|
||||||
|
The function shall request the RSA Signature generation from the WINC Firmware for the given message. The signed message shall be
|
||||||
|
compressed to the corresponding hash algorithm before calling this function.
|
||||||
|
The hash type is identified by the given hash length. For example, if the hash length is 32 bytes, then it is SHA256.
|
||||||
|
|
||||||
|
@param[in] pu8N
|
||||||
|
RSA Key modulus n.
|
||||||
|
|
||||||
|
@param[in] u16NSize
|
||||||
|
Size of the RSA modulus n in bytes.
|
||||||
|
|
||||||
|
@param[in] pu8d
|
||||||
|
RSA private exponent.
|
||||||
|
|
||||||
|
@param[in] u16dSize
|
||||||
|
Size of the RSA private exponent in bytes.
|
||||||
|
|
||||||
|
@param[in] pu8SignedMsgHash
|
||||||
|
The hash digest of the signed message.
|
||||||
|
|
||||||
|
@param[in] u16HashLength
|
||||||
|
The length of the hash digest.
|
||||||
|
|
||||||
|
@param[out] pu8RsaSignature
|
||||||
|
Pointer to a user buffer allocated by teh caller shall hold the generated signature.
|
||||||
|
*/
|
||||||
|
sint8 m2m_crypto_rsa_sign_gen(uint8 *pu8N, uint16 u16NSize, uint8 *pu8d, uint16 u16dSize, uint8 *pu8SignedMsgHash,
|
||||||
|
uint16 u16HashLength, uint8 *pu8RsaSignature);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __M2M_CRYPTO_H__ */
|
||||||
@ -2,7 +2,7 @@
|
|||||||
*
|
*
|
||||||
* \file
|
* \file
|
||||||
*
|
*
|
||||||
* \brief NMC1500 IoT OTA Interface.
|
* \brief WINC OTA Upgrade API Interface.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015 Atmel Corporation. All rights reserved.
|
* Copyright (c) 2015 Atmel Corporation. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -48,8 +48,9 @@ INCLUDES
|
|||||||
|
|
||||||
#include "common/include/nm_common.h"
|
#include "common/include/nm_common.h"
|
||||||
#include "driver/include/m2m_types.h"
|
#include "driver/include/m2m_types.h"
|
||||||
/**@defgroup OTATYPEDEF WLANTypedef
|
#include "driver/include/nmdrv.h"
|
||||||
* @ingroup WlanEnums
|
/**@addtogroup WlanEnums Enumerations and Typedefs
|
||||||
|
* @ingroup m2m_wifi
|
||||||
*/
|
*/
|
||||||
/* @{ */
|
/* @{ */
|
||||||
|
|
||||||
@ -321,6 +322,17 @@ NMI_API sint8 m2m_ota_rollback(void);
|
|||||||
The function returns @ref M2M_SUCCESS for successful operations and a negative value otherwise.
|
The function returns @ref M2M_SUCCESS for successful operations and a negative value otherwise.
|
||||||
*/
|
*/
|
||||||
NMI_API sint8 m2m_ota_switch_firmware(void);
|
NMI_API sint8 m2m_ota_switch_firmware(void);
|
||||||
|
/*!
|
||||||
|
@fn \
|
||||||
|
NMI_API sint8 m2m_ota_get_firmware_version(void);
|
||||||
|
|
||||||
|
@brief
|
||||||
|
Get the OTA Firmware version.
|
||||||
|
|
||||||
|
@return
|
||||||
|
The function SHALL return 0 for success and a negative value otherwise.
|
||||||
|
*/
|
||||||
|
NMI_API sint8 m2m_ota_get_firmware_version(tstrM2mRev *pstrRev);
|
||||||
/**@}*/
|
/**@}*/
|
||||||
NMI_API sint8 m2m_ota_test(void);
|
NMI_API sint8 m2m_ota_test(void);
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
*
|
*
|
||||||
* \file
|
* \file
|
||||||
*
|
*
|
||||||
* \brief NMC1500 Peripherals Application Interface.
|
* \brief WINC Peripherals Application Interface.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015 Atmel Corporation. All rights reserved.
|
* Copyright (c) 2015 Atmel Corporation. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -79,6 +79,10 @@ typedef struct {
|
|||||||
A list of GPIO numbers configurable through the m2m_periph module.
|
A list of GPIO numbers configurable through the m2m_periph module.
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
M2M_PERIPH_GPIO3, /*!< GPIO15 pad */
|
||||||
|
M2M_PERIPH_GPIO4, /*!< GPIO16 pad */
|
||||||
|
M2M_PERIPH_GPIO5, /*!< GPIO18 pad */
|
||||||
|
M2M_PERIPH_GPIO6, /*!< GPIO18 pad */
|
||||||
M2M_PERIPH_GPIO15, /*!< GPIO15 pad */
|
M2M_PERIPH_GPIO15, /*!< GPIO15 pad */
|
||||||
M2M_PERIPH_GPIO16, /*!< GPIO16 pad */
|
M2M_PERIPH_GPIO16, /*!< GPIO16 pad */
|
||||||
M2M_PERIPH_GPIO18, /*!< GPIO18 pad */
|
M2M_PERIPH_GPIO18, /*!< GPIO18 pad */
|
||||||
@ -165,35 +169,35 @@ typedef enum {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
M2M_PERIPH_PULLUP_HOST_WAKEUP = (1ul << 0),
|
M2M_PERIPH_PULLUP_DIS_HOST_WAKEUP = (1ul << 0),
|
||||||
M2M_PERIPH_PULLUP_RTC_CLK = (1ul << 1),
|
M2M_PERIPH_PULLUP_DIS_RTC_CLK = (1ul << 1),
|
||||||
M2M_PERIPH_PULLUP_IRQN = (1ul << 2),
|
M2M_PERIPH_PULLUP_DIS_IRQN = (1ul << 2),
|
||||||
M2M_PERIPH_PULLUP_GPIO_3 = (1ul << 3),
|
M2M_PERIPH_PULLUP_DIS_GPIO_3 = (1ul << 3),
|
||||||
M2M_PERIPH_PULLUP_GPIO_4 = (1ul << 4),
|
M2M_PERIPH_PULLUP_DIS_GPIO_4 = (1ul << 4),
|
||||||
M2M_PERIPH_PULLUP_GPIO_5 = (1ul << 5),
|
M2M_PERIPH_PULLUP_DIS_GPIO_5 = (1ul << 5),
|
||||||
M2M_PERIPH_PULLUP_SD_DAT3 = (1ul << 6),
|
M2M_PERIPH_PULLUP_DIS_SD_DAT3 = (1ul << 6),
|
||||||
M2M_PERIPH_PULLUP_SD_DAT2_SPI_RXD = (1ul << 7),
|
M2M_PERIPH_PULLUP_DIS_SD_DAT2_SPI_RXD = (1ul << 7),
|
||||||
M2M_PERIPH_PULLUP_SD_DAT1_SPI_SSN = (1ul << 8),
|
M2M_PERIPH_PULLUP_DIS_SD_DAT1_SPI_SSN = (1ul << 9),
|
||||||
M2M_PERIPH_PULLUP_SD_CMD_SPI_SCK = (1ul << 9),
|
M2M_PERIPH_PULLUP_DIS_SD_CMD_SPI_SCK = (1ul << 10),
|
||||||
M2M_PERIPH_PULLUP_SD_DAT0_SPI_TXD = (1ul << 10),
|
M2M_PERIPH_PULLUP_DIS_SD_DAT0_SPI_TXD = (1ul << 11),
|
||||||
M2M_PERIPH_PULLUP_GPIO_6 = (1ul << 11),
|
M2M_PERIPH_PULLUP_DIS_GPIO_6 = (1ul << 12),
|
||||||
M2M_PERIPH_PULLUP_SD_CLK = (1ul << 12),
|
M2M_PERIPH_PULLUP_DIS_SD_CLK = (1ul << 13),
|
||||||
M2M_PERIPH_PULLUP_I2C_SCL = (1ul << 13),
|
M2M_PERIPH_PULLUP_DIS_I2C_SCL = (1ul << 14),
|
||||||
M2M_PERIPH_PULLUP_I2C_SDA = (1ul << 14),
|
M2M_PERIPH_PULLUP_DIS_I2C_SDA = (1ul << 15),
|
||||||
M2M_PERIPH_PULLUP_GPIO_11 = (1ul << 15),
|
M2M_PERIPH_PULLUP_DIS_GPIO_11 = (1ul << 16),
|
||||||
M2M_PERIPH_PULLUP_GPIO_12 = (1ul << 16),
|
M2M_PERIPH_PULLUP_DIS_GPIO_12 = (1ul << 17),
|
||||||
M2M_PERIPH_PULLUP_GPIO_13 = (1ul << 17),
|
M2M_PERIPH_PULLUP_DIS_GPIO_13 = (1ul << 18),
|
||||||
M2M_PERIPH_PULLUP_GPIO_14 = (1ul << 18),
|
M2M_PERIPH_PULLUP_DIS_GPIO_14 = (1ul << 19),
|
||||||
M2M_PERIPH_PULLUP_GPIO_15 = (1ul << 19),
|
M2M_PERIPH_PULLUP_DIS_GPIO_15 = (1ul << 20),
|
||||||
M2M_PERIPH_PULLUP_GPIO_16 = (1ul << 20),
|
M2M_PERIPH_PULLUP_DIS_GPIO_16 = (1ul << 21),
|
||||||
M2M_PERIPH_PULLUP_GPIO_17 = (1ul << 21),
|
M2M_PERIPH_PULLUP_DIS_GPIO_17 = (1ul << 22),
|
||||||
M2M_PERIPH_PULLUP_GPIO_18 = (1ul << 22),
|
M2M_PERIPH_PULLUP_DIS_GPIO_18 = (1ul << 23),
|
||||||
M2M_PERIPH_PULLUP_GPIO_19 = (1ul << 23),
|
M2M_PERIPH_PULLUP_DIS_GPIO_19 = (1ul << 24),
|
||||||
M2M_PERIPH_PULLUP_GPIO_20 = (1ul << 24),
|
M2M_PERIPH_PULLUP_DIS_GPIO_20 = (1ul << 25),
|
||||||
M2M_PERIPH_PULLUP_GPIO_21 = (1ul << 25),
|
M2M_PERIPH_PULLUP_DIS_GPIO_21 = (1ul << 26),
|
||||||
M2M_PERIPH_PULLUP_GPIO_22 = (1ul << 26),
|
M2M_PERIPH_PULLUP_DIS_GPIO_22 = (1ul << 27),
|
||||||
M2M_PERIPH_PULLUP_GPIO_23 = (1ul << 27),
|
M2M_PERIPH_PULLUP_DIS_GPIO_23 = (1ul << 28),
|
||||||
M2M_PERIPH_PULLUP_GPIO_24 = (1ul << 28),
|
M2M_PERIPH_PULLUP_DIS_GPIO_24 = (1ul << 29),
|
||||||
} tenuPullupMask;
|
} tenuPullupMask;
|
||||||
|
|
||||||
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
*
|
*
|
||||||
* \file
|
* \file
|
||||||
*
|
*
|
||||||
* \brief NMC1500 IoT Application Interface Internal Types.
|
* \brief WINC Application Interface Internal Types.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015 Atmel Corporation. All rights reserved.
|
* Copyright (c) 2015 Atmel Corporation. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -95,6 +95,16 @@ MACROS
|
|||||||
( ((uint32)M2M_MAKE_VERSION((fw_major), (fw_minor), (fw_patch))) << M2M_FW_VERSION_SHIFT) | \
|
( ((uint32)M2M_MAKE_VERSION((fw_major), (fw_minor), (fw_patch))) << M2M_FW_VERSION_SHIFT) | \
|
||||||
( ((uint32)M2M_MAKE_VERSION((drv_major), (drv_minor), (drv_patch))) << M2M_DRV_VERSION_SHIFT))
|
( ((uint32)M2M_MAKE_VERSION((drv_major), (drv_minor), (drv_patch))) << M2M_DRV_VERSION_SHIFT))
|
||||||
|
|
||||||
|
#define REL_19_4_1_VER M2M_MAKE_VERSION_INFO(19,4,1,19,3,0)
|
||||||
|
#define REL_19_4_0_VER M2M_MAKE_VERSION_INFO(19,4,0,19,3,0)
|
||||||
|
#define REL_19_3_1_VER M2M_MAKE_VERSION_INFO(19,3,1,19,3,0)
|
||||||
|
#define REL_19_3_0_VER M2M_MAKE_VERSION_INFO(19,3,0,19,3,0)
|
||||||
|
#define REL_19_2_2_VER M2M_MAKE_VERSION_INFO(19,2,2,19,2,0)
|
||||||
|
#define REL_19_2_1_VER M2M_MAKE_VERSION_INFO(19,2,1,19,2,0)
|
||||||
|
#define REL_19_2_0_VER M2M_MAKE_VERSION_INFO(19,2,0,19,2,0)
|
||||||
|
#define REL_19_1_0_VER M2M_MAKE_VERSION_INFO(19,1,0,18,2,0)
|
||||||
|
#define REL_19_0_0_VER M2M_MAKE_VERSION_INFO(19,0,0,18,1,1)
|
||||||
|
|
||||||
/*======*======*======*======*
|
/*======*======*======*======*
|
||||||
FIRMWARE VERSION NO INFO
|
FIRMWARE VERSION NO INFO
|
||||||
*======*======*======*======*/
|
*======*======*======*======*/
|
||||||
@ -104,11 +114,11 @@ MACROS
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define M2M_FIRMWARE_VERSION_MINOR_NO (3)
|
#define M2M_FIRMWARE_VERSION_MINOR_NO (4)
|
||||||
/*!< Firmware Minor release version number.
|
/*!< Firmware Minor release version number.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define M2M_FIRMWARE_VERSION_PATCH_NO (0)
|
#define M2M_FIRMWARE_VERSION_PATCH_NO (4)
|
||||||
/*!< Firmware patch release version number.
|
/*!< Firmware patch release version number.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -191,7 +201,10 @@ MACROS
|
|||||||
#define M2M_CUST_IE_LEN_MAX 252
|
#define M2M_CUST_IE_LEN_MAX 252
|
||||||
/*!< The maximum size of IE (Information Element).
|
/*!< The maximum size of IE (Information Element).
|
||||||
*/
|
*/
|
||||||
|
/*********************
|
||||||
|
*
|
||||||
|
* WIFI GROUP requests
|
||||||
|
*/
|
||||||
|
|
||||||
#define M2M_CONFIG_CMD_BASE 1
|
#define M2M_CONFIG_CMD_BASE 1
|
||||||
/*!< The base value of all the host configuration commands opcodes.
|
/*!< The base value of all the host configuration commands opcodes.
|
||||||
@ -205,13 +218,28 @@ MACROS
|
|||||||
#define M2M_P2P_CMD_BASE 90
|
#define M2M_P2P_CMD_BASE 90
|
||||||
/*!< The base value of all the P2P mode host commands opcodes.
|
/*!< The base value of all the P2P mode host commands opcodes.
|
||||||
*/
|
*/
|
||||||
#define M2M_OTA_CMD_BASE 100
|
#define M2M_SERVER_CMD_BASE 100
|
||||||
/*!< The base value of all the OTA mode host commands opcodes.
|
|
||||||
*/
|
|
||||||
#define M2M_SERVER_CMD_BASE 120
|
|
||||||
/*!< The base value of all the power save mode host commands codes.
|
/*!< The base value of all the power save mode host commands codes.
|
||||||
*/
|
*/
|
||||||
|
/**********************
|
||||||
|
* OTA GROUP requests
|
||||||
|
*/
|
||||||
|
#define M2M_OTA_CMD_BASE 100
|
||||||
|
/*!< The base value of all the OTA mode host commands opcodes.
|
||||||
|
* The OTA Have special group so can extended from 1-M2M_MAX_GRP_NUM_REQ
|
||||||
|
*/
|
||||||
|
/***********************
|
||||||
|
*
|
||||||
|
* CRYPTO group requests
|
||||||
|
*/
|
||||||
|
#define M2M_CRYPTO_CMD_BASE 1
|
||||||
|
/*!< The base value of all the crypto mode host commands opcodes.
|
||||||
|
* The crypto Have special group so can extended from 1-M2M_MAX_GRP_NUM_REQ
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define M2M_MAX_GRP_NUM_REQ (127)
|
||||||
|
/*!< max number of request in one group equal to 127 as the last bit reserved for config or data pkt
|
||||||
|
*/
|
||||||
|
|
||||||
#define WEP_40_KEY_STRING_SIZE ((uint8)10)
|
#define WEP_40_KEY_STRING_SIZE ((uint8)10)
|
||||||
/*!< Indicate the wep key size in bytes for 40 bit string passphrase.
|
/*!< Indicate the wep key size in bytes for 40 bit string passphrase.
|
||||||
@ -223,72 +251,47 @@ MACROS
|
|||||||
#define WEP_KEY_MAX_INDEX ((uint8)4)
|
#define WEP_KEY_MAX_INDEX ((uint8)4)
|
||||||
/*!< Indicate the max key index value for WEP authentication
|
/*!< Indicate the max key index value for WEP authentication
|
||||||
*/
|
*/
|
||||||
|
#define M2M_SHA256_CONTEXT_BUFF_LEN (128)
|
||||||
|
/*!< sha256 context size
|
||||||
|
*/
|
||||||
#define M2M_SCAN_DEFAULT_NUM_SLOTS (2)
|
#define M2M_SCAN_DEFAULT_NUM_SLOTS (2)
|
||||||
/*!< The default. number of scan slots performed by the WINC board.
|
/*!< The default. number of scan slots performed by the WINC board.
|
||||||
*/
|
*/
|
||||||
#define M2M_SCAN_DEFAULT_SLOT_TIME (20)
|
#define M2M_SCAN_DEFAULT_SLOT_TIME (30)
|
||||||
/*!< The default. duration in miliseconds of a scan slots performed by the WINC board.
|
/*!< The default. duration in miliseconds of a scan slots performed by the WINC board.
|
||||||
*/
|
*/
|
||||||
#define M2M_SCAN_DEFAULT_NUM_PROBE (2)
|
#define M2M_SCAN_DEFAULT_NUM_PROBE (2)
|
||||||
/*!< The default. number of scan slots performed by the WINC board.
|
/*!< The default. number of scan slots performed by the WINC board.
|
||||||
*/
|
*/
|
||||||
#define M2M_SCAN_FAIL ((uint8)1)
|
|
||||||
/*!< Indicate that the WINC board has failed to perform the scan operation.
|
|
||||||
*/
|
|
||||||
#define M2M_JOIN_FAIL ((uint8)2)
|
|
||||||
/*!< Indicate that the WINC board has failed to join the BSS .
|
|
||||||
*/
|
|
||||||
#define M2M_AUTH_FAIL ((uint8)3)
|
|
||||||
/*!< Indicate that the WINC board has failed to authenticate with the AP.
|
|
||||||
*/
|
|
||||||
#define M2M_ASSOC_FAIL ((uint8)4)
|
|
||||||
/*!< Indicate that the WINC board has failed to associate with the AP.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define M2M_SCAN_ERR_WIFI ((sint8)-2)
|
|
||||||
/*!< currently not used.
|
|
||||||
*/
|
|
||||||
#define M2M_SCAN_ERR_IP ((sint8)-3)
|
|
||||||
/*!< currently not used.
|
|
||||||
*/
|
|
||||||
#define M2M_SCAN_ERR_AP ((sint8)-4)
|
|
||||||
/*!< currently not used.
|
|
||||||
*/
|
|
||||||
#define M2M_SCAN_ERR_P2P ((sint8)-5)
|
|
||||||
/*!< currently not used.
|
|
||||||
*/
|
|
||||||
#define M2M_SCAN_ERR_WPS ((sint8)-6)
|
|
||||||
/*!< currently not used.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#define M2M_DEFAULT_CONN_EMPTY_LIST ((sint8)-20)
|
/*======*======*======*======*
|
||||||
|
CONNECTION ERROR DEFINITIONS
|
||||||
|
*======*======*======*======*/
|
||||||
|
typedef enum {
|
||||||
|
M2M_DEFAULT_CONN_INPROGRESS = ((sint8)-23),
|
||||||
|
/*!<
|
||||||
|
A failure that indicates that a default connection or forced connection is in progress
|
||||||
|
*/
|
||||||
|
M2M_DEFAULT_CONN_FAIL,
|
||||||
|
/*!<
|
||||||
|
A failure response that indicates that the winc failed to connect to the cached network
|
||||||
|
*/
|
||||||
|
M2M_DEFAULT_CONN_SCAN_MISMATCH,
|
||||||
|
/*!<
|
||||||
|
A failure response that indicates that no one of the cached networks
|
||||||
|
was found in the scan results, as a result to the function call m2m_default_connect.
|
||||||
|
*/
|
||||||
|
M2M_DEFAULT_CONN_EMPTY_LIST
|
||||||
/*!<
|
/*!<
|
||||||
A failure response that indicates an empty network list as
|
A failure response that indicates an empty network list as
|
||||||
a result to the function call m2m_default_connect.
|
a result to the function call m2m_default_connect.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
}tenuM2mDefaultConnErrcode;
|
||||||
|
|
||||||
#define M2M_DEFAULT_CONN_SCAN_MISMATCH ((sint8)-21)
|
|
||||||
/*!<
|
|
||||||
A failure response that indicates that no one of the cached networks
|
|
||||||
was found in the scan results, as a result to the function call m2m_default_connect.
|
|
||||||
*/
|
|
||||||
#define M2M_DEFAULT_CONN_FAIL ((sint8)-22)
|
|
||||||
|
|
||||||
/*!<
|
|
||||||
A failure response that indicates that the winc failed to connect to the cached network
|
|
||||||
*/
|
|
||||||
/*======*======*======*======*
|
|
||||||
MONTIORING MODE DEFINITIONS
|
|
||||||
*======*======*======*======*/
|
|
||||||
|
|
||||||
#define M2M_WIFI_FRAME_TYPE_ANY 0xFF
|
|
||||||
/*!< Set monitor mode to receive any of the frames types
|
|
||||||
*/
|
|
||||||
#define M2M_WIFI_FRAME_SUB_TYPE_ANY 0xFF
|
|
||||||
/*!< Set monitor mode to receive frames with any sub type
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*======*======*======*======*
|
/*======*======*======*======*
|
||||||
OTA DEFINITIONS
|
OTA DEFINITIONS
|
||||||
@ -306,6 +309,12 @@ MACROS
|
|||||||
/*!<
|
/*!<
|
||||||
Magic value set at the beginning of the OTA image header
|
Magic value set at the beginning of the OTA image header
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define OTA_FORMAT_VER_0 (0) /*Till 19.2.2 format*/
|
||||||
|
#define OTA_FORMAT_VER_1 (1) /*starting from 19.3.0 CRC is used and sequence number is used*/
|
||||||
|
/*!<
|
||||||
|
Control structure format version
|
||||||
|
*/
|
||||||
#define OTA_SHA256_DIGEST_SIZE (32)
|
#define OTA_SHA256_DIGEST_SIZE (32)
|
||||||
/*!<
|
/*!<
|
||||||
Sha256 digest size in the OTA image,
|
Sha256 digest size in the OTA image,
|
||||||
@ -350,9 +359,35 @@ MACROS
|
|||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup WlanEnums
|
* @addtogroup WlanEnums Enumerations and Typedefs
|
||||||
|
* @ingroup m2m_wifi
|
||||||
*/
|
*/
|
||||||
/**@{*/
|
/**@{*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@enum \
|
||||||
|
tenuM2mConnChangedErrcode
|
||||||
|
|
||||||
|
@brief
|
||||||
|
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
M2M_ERR_SCAN_FAIL = ((uint8)1),
|
||||||
|
/*!< Indicate that the WINC board has failed to perform the scan operation.
|
||||||
|
*/
|
||||||
|
M2M_ERR_JOIN_FAIL,
|
||||||
|
/*!< Indicate that the WINC board has failed to join the BSS .
|
||||||
|
*/
|
||||||
|
M2M_ERR_AUTH_FAIL,
|
||||||
|
/*!< Indicate that the WINC board has failed to authenticate with the AP.
|
||||||
|
*/
|
||||||
|
M2M_ERR_ASSOC_FAIL,
|
||||||
|
/*!< Indicate that the WINC board has failed to associate with the AP.
|
||||||
|
*/
|
||||||
|
M2M_ERR_CONN_INPROGRESS,
|
||||||
|
/*!< Indicate that the WINC board has another connection request in progress.
|
||||||
|
*/
|
||||||
|
}tenuM2mConnChangedErrcode;
|
||||||
/*!
|
/*!
|
||||||
@enum \
|
@enum \
|
||||||
tenuM2mWepKeyIndex
|
tenuM2mWepKeyIndex
|
||||||
@ -380,11 +415,11 @@ typedef enum {
|
|||||||
PWR_AUTO = ((uint8) 1),
|
PWR_AUTO = ((uint8) 1),
|
||||||
/*!< FW will decide the best power mode to use internally. */
|
/*!< FW will decide the best power mode to use internally. */
|
||||||
PWR_LOW1,
|
PWR_LOW1,
|
||||||
/*low power mode #1. RX current 60mA, sensitivity Ok.*/
|
/*low power mode #1*/
|
||||||
PWR_LOW2,
|
PWR_LOW2,
|
||||||
/*low power mode #2, RX current 55mA, sensitivity is less by 3dBm*/
|
/*low power mode #2*/
|
||||||
PWR_HIGH,
|
PWR_HIGH,
|
||||||
/* high power mode: RX current 100mA.*/
|
/* high power mode*/
|
||||||
}tenuM2mPwrMode;
|
}tenuM2mPwrMode;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -467,6 +502,33 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
}tstrM2mBatteryVoltage;
|
}tstrM2mBatteryVoltage;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@enum \
|
||||||
|
tenuM2mReqGroup
|
||||||
|
|
||||||
|
@brief
|
||||||
|
*/
|
||||||
|
typedef enum{
|
||||||
|
M2M_REQ_GROUP_MAIN = 0,
|
||||||
|
M2M_REQ_GROUP_WIFI,
|
||||||
|
M2M_REQ_GROUP_IP,
|
||||||
|
M2M_REQ_GROUP_HIF,
|
||||||
|
M2M_REQ_GROUP_OTA,
|
||||||
|
M2M_REQ_GROUP_SSL,
|
||||||
|
M2M_REQ_GROUP_CRYPTO,
|
||||||
|
M2M_REQ_GROUP_SIGMA,
|
||||||
|
}tenuM2mReqGroup;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@enum \
|
||||||
|
tenuM2mReqpkt
|
||||||
|
|
||||||
|
@brief
|
||||||
|
*/
|
||||||
|
typedef enum{
|
||||||
|
M2M_REQ_CONFIG_PKT,
|
||||||
|
M2M_REQ_DATA_PKT = 0x80 /*BIT7*/
|
||||||
|
}tenuM2mReqpkt;
|
||||||
/*!
|
/*!
|
||||||
@enum \
|
@enum \
|
||||||
tenuM2mConfigCmd
|
tenuM2mConfigCmd
|
||||||
@ -583,6 +645,12 @@ typedef enum {
|
|||||||
M2M_WIFI_REQ_SET_MAC_MCAST,
|
M2M_WIFI_REQ_SET_MAC_MCAST,
|
||||||
/*!< Set the WINC multicast filters.
|
/*!< Set the WINC multicast filters.
|
||||||
*/
|
*/
|
||||||
|
M2M_WIFI_REQ_GET_PRNG,
|
||||||
|
/*!< Request PRNG.
|
||||||
|
*/
|
||||||
|
M2M_WIFI_RESP_GET_PRNG,
|
||||||
|
/*!< Response for PRNG.
|
||||||
|
*/
|
||||||
M2M_WIFI_MAX_CONFIG_ALL,
|
M2M_WIFI_MAX_CONFIG_ALL,
|
||||||
}tenuM2mConfigCmd;
|
}tenuM2mConfigCmd;
|
||||||
|
|
||||||
@ -700,6 +768,24 @@ typedef enum {
|
|||||||
}tenuM2mP2pCmd;
|
}tenuM2mP2pCmd;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@enum \
|
||||||
|
tenuM2mServerCmd
|
||||||
|
|
||||||
|
@brief
|
||||||
|
This enum contains all the WINC commands while in PS mode.
|
||||||
|
These command are currently not supported.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
M2M_WIFI_REQ_CLIENT_CTRL = M2M_SERVER_CMD_BASE,
|
||||||
|
M2M_WIFI_RESP_CLIENT_INFO,
|
||||||
|
M2M_WIFI_REQ_SERVER_INIT,
|
||||||
|
M2M_WIFI_MAX_SERVER_ALL
|
||||||
|
}tenuM2mServerCmd;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@enum \
|
@enum \
|
||||||
tenuM2mOtaCmd
|
tenuM2mOtaCmd
|
||||||
@ -720,24 +806,26 @@ typedef enum {
|
|||||||
M2M_OTA_MAX_ALL,
|
M2M_OTA_MAX_ALL,
|
||||||
}tenuM2mOtaCmd;
|
}tenuM2mOtaCmd;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@enum \
|
@enum \
|
||||||
tenuM2mServerCmd
|
tenuM2mCryptoCmd
|
||||||
|
|
||||||
@brief
|
@brief
|
||||||
This enum contains all the WINC commands while in PS mode.
|
|
||||||
These command are currently not supported.
|
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
M2M_WIFI_REQ_CLIENT_CTRL = M2M_SERVER_CMD_BASE,
|
M2M_CRYPTO_REQ_SHA256_INIT = M2M_CRYPTO_CMD_BASE,
|
||||||
M2M_WIFI_RESP_CLIENT_INFO,
|
M2M_CRYPTO_RESP_SHA256_INIT,
|
||||||
M2M_WIFI_REQ_SERVER_INIT,
|
M2M_CRYPTO_REQ_SHA256_UPDATE,
|
||||||
M2M_WIFI_MAX_SERVER_ALL
|
M2M_CRYPTO_RESP_SHA256_UPDATE,
|
||||||
}tenuM2mServerCmd;
|
M2M_CRYPTO_REQ_SHA256_FINSIH,
|
||||||
|
M2M_CRYPTO_RESP_SHA256_FINSIH,
|
||||||
|
M2M_CRYPTO_REQ_RSA_SIGN_GEN,
|
||||||
|
M2M_CRYPTO_RESP_RSA_SIGN_GEN,
|
||||||
|
M2M_CRYPTO_REQ_RSA_SIGN_VERIFY,
|
||||||
|
M2M_CRYPTO_RESP_RSA_SIGN_VERIFY,
|
||||||
|
M2M_CRYPTO_MAX_ALL,
|
||||||
|
}tenuM2mCryptoCmd;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@enum \
|
@enum \
|
||||||
@ -753,6 +841,28 @@ typedef enum {
|
|||||||
M2M_IP_REQ_DISABLE_DHCP
|
M2M_IP_REQ_DISABLE_DHCP
|
||||||
} tenuM2mIpCmd;
|
} tenuM2mIpCmd;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@enum \
|
||||||
|
tenuM2mSigmaCmd
|
||||||
|
|
||||||
|
@brief
|
||||||
|
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
/* Request IDs corresponding to the IP GROUP. */
|
||||||
|
M2M_SIGMA_ENABLE = ((uint8) 3),
|
||||||
|
M2M_SIGMA_TA_START,
|
||||||
|
M2M_SIGMA_TA_STATS,
|
||||||
|
M2M_SIGMA_TA_RECEIVE_STOP,
|
||||||
|
M2M_SIGMA_ICMP_ARP,
|
||||||
|
M2M_SIGMA_ICMP_RX,
|
||||||
|
M2M_SIGMA_ICMP_TX,
|
||||||
|
M2M_SIGMA_UDP_TX,
|
||||||
|
M2M_SIGMA_UDP_TX_DEFER,
|
||||||
|
M2M_SIGMA_SECURITY_POLICY,
|
||||||
|
M2M_SIGMA_SET_SYSTIME
|
||||||
|
} tenuM2mSigmaCmd;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@enum \
|
@enum \
|
||||||
@ -918,9 +1028,16 @@ typedef enum {
|
|||||||
M2M_WIFI_MODE_NORMAL = ((uint8) 1),
|
M2M_WIFI_MODE_NORMAL = ((uint8) 1),
|
||||||
/*!< Normal Mode means to run customer firmware version.
|
/*!< Normal Mode means to run customer firmware version.
|
||||||
*/
|
*/
|
||||||
M2M_WIFI_MODE_CONFIG,
|
M2M_WIFI_MODE_ATE_HIGH,
|
||||||
/*!< Config Mode means to run production test firmware version which is known as ATE (Burst) firmware.
|
/*!< Config Mode in HIGH POWER means to run production test firmware version which is known as ATE (Burst) firmware.
|
||||||
*/
|
*/
|
||||||
|
M2M_WIFI_MODE_ATE_LOW,
|
||||||
|
/*!< Config Mode in LOW POWER means to run production test firmware version which is known as ATE (Burst) firmware.
|
||||||
|
*/
|
||||||
|
M2M_WIFI_MODE_ETHERNET,
|
||||||
|
/*!< etherent Mode
|
||||||
|
*/
|
||||||
|
M2M_WIFI_MODE_MAX,
|
||||||
}tenuM2mWifiMode;
|
}tenuM2mWifiMode;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -1081,9 +1198,6 @@ typedef struct {
|
|||||||
|
|
||||||
@sa
|
@sa
|
||||||
tenuM2mSecType
|
tenuM2mSecType
|
||||||
|
|
||||||
@todo
|
|
||||||
Use different error codes to differentiate error types.
|
|
||||||
*/
|
*/
|
||||||
typedef struct{
|
typedef struct{
|
||||||
uint8 u8AuthType;
|
uint8 u8AuthType;
|
||||||
@ -1189,6 +1303,21 @@ typedef struct {
|
|||||||
|
|
||||||
}tstrM2MScan;
|
}tstrM2MScan;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@struct \
|
||||||
|
tstrCyptoResp
|
||||||
|
|
||||||
|
@brief
|
||||||
|
crypto response
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
sint8 s8Resp;
|
||||||
|
/***/
|
||||||
|
uint8 __PAD24__[3];
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
}tstrCyptoResp;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@struct \
|
@struct \
|
||||||
@ -1269,14 +1398,14 @@ typedef struct {
|
|||||||
Wi-Fi Connection State
|
Wi-Fi Connection State
|
||||||
|
|
||||||
@sa
|
@sa
|
||||||
M2M_WIFI_DISCONNECTED, M2M_WIFI_CONNECTED, M2M_WIFI_REQ_CON_STATE_CHANGED
|
M2M_WIFI_DISCONNECTED, M2M_WIFI_CONNECTED, M2M_WIFI_REQ_CON_STATE_CHANGED,tenuM2mConnChangedErrcode
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8 u8CurrState;
|
uint8 u8CurrState;
|
||||||
/*!< Current Wi-Fi connection state
|
/*!< Current Wi-Fi connection state
|
||||||
*/
|
*/
|
||||||
uint8 u8ErrCode;
|
uint8 u8ErrCode;
|
||||||
/*!< Error type
|
/*!< Error type review tenuM2mConnChangedErrcode
|
||||||
*/
|
*/
|
||||||
uint8 __PAD16__[2];
|
uint8 __PAD16__[2];
|
||||||
/*!< Padding bytes for forcing 4-byte alignment
|
/*!< Padding bytes for forcing 4-byte alignment
|
||||||
@ -1736,6 +1865,7 @@ typedef struct{
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
}tstrOtaInitHdr;
|
}tstrOtaInitHdr;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@struct \
|
@struct \
|
||||||
tstrOtaControlSec
|
tstrOtaControlSec
|
||||||
@ -1752,6 +1882,8 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
uint32 u32OtaFormatVersion;
|
uint32 u32OtaFormatVersion;
|
||||||
/*!<
|
/*!<
|
||||||
|
NA NA NA Flash version cs struct version
|
||||||
|
00 00 00 00 00
|
||||||
Control structure format version, the value will be incremented in case of structure changed or updated
|
Control structure format version, the value will be incremented in case of structure changed or updated
|
||||||
*/
|
*/
|
||||||
uint32 u32OtaSequenceNumber;
|
uint32 u32OtaSequenceNumber;
|
||||||
@ -1834,6 +1966,12 @@ typedef enum {
|
|||||||
/*!< An OTA operation is already enabled. */
|
/*!< An OTA operation is already enabled. */
|
||||||
OTA_STATUS_UPDATE_INPROGRESS = 6,
|
OTA_STATUS_UPDATE_INPROGRESS = 6,
|
||||||
/*!< An OTA operation update is in progress */
|
/*!< An OTA operation update is in progress */
|
||||||
|
OTA_STATUS_IMAGE_VERIF_FAILED = 7,
|
||||||
|
/*!< OTA Verfication failed */
|
||||||
|
OTA_STATUS_CONNECTION_ERROR = 8,
|
||||||
|
/*!< OTA connection error */
|
||||||
|
OTA_STATUS_SERVER_ERROR = 9,
|
||||||
|
/*!< OTA server Error (file not found or else ...) */
|
||||||
} tenuOtaUpdateStatus;
|
} tenuOtaUpdateStatus;
|
||||||
/*!
|
/*!
|
||||||
@enum \
|
@enum \
|
||||||
@ -1956,6 +2094,28 @@ typedef struct{
|
|||||||
*/
|
*/
|
||||||
}tstrM2MMulticastMac;
|
}tstrM2MMulticastMac;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@struct \
|
||||||
|
tstrPrng
|
||||||
|
|
||||||
|
@brief
|
||||||
|
M2M Request PRNG
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
/*!<
|
||||||
|
return buffer address
|
||||||
|
*/
|
||||||
|
uint8 *pu8RngBuff;
|
||||||
|
/*!<
|
||||||
|
PRNG size requested
|
||||||
|
*/
|
||||||
|
uint16 u16PrngSize;
|
||||||
|
/*!<
|
||||||
|
PRNG pads
|
||||||
|
*/
|
||||||
|
uint8 __PAD16__[2];
|
||||||
|
}tstrPrng;
|
||||||
|
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
*
|
*
|
||||||
* \file
|
* \file
|
||||||
*
|
*
|
||||||
* \brief NMC1500 IoT Application Interface.
|
* \brief WINC WLAN Application Interface.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015 Atmel Corporation. All rights reserved.
|
* Copyright (c) 2015 Atmel Corporation. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -42,6 +42,10 @@
|
|||||||
#ifndef __M2M_WIFI_H__
|
#ifndef __M2M_WIFI_H__
|
||||||
#define __M2M_WIFI_H__
|
#define __M2M_WIFI_H__
|
||||||
|
|
||||||
|
/** \defgroup m2m_wifi WLAN
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
||||||
INCLUDES
|
INCLUDES
|
||||||
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
|
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
|
||||||
@ -56,7 +60,7 @@ INCLUDES
|
|||||||
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
||||||
MACROS
|
MACROS
|
||||||
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
|
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
|
||||||
/**@defgroup WlanEnums Enumeration/Typedef
|
/**@defgroup WlanEnums Enumerations and Typedefs
|
||||||
* @ingroup m2m_wifi
|
* @ingroup m2m_wifi
|
||||||
* @{*/
|
* @{*/
|
||||||
/*!
|
/*!
|
||||||
@ -85,7 +89,11 @@ typedef enum {
|
|||||||
DATA_BASICTYPE = 0x08,
|
DATA_BASICTYPE = 0x08,
|
||||||
/*!< Wi-Fi Data frame.
|
/*!< Wi-Fi Data frame.
|
||||||
*/
|
*/
|
||||||
RESERVED = 0x0C
|
RESERVED = 0x0C,
|
||||||
|
|
||||||
|
M2M_WIFI_FRAME_TYPE_ANY = 0xFF
|
||||||
|
/*!< Set monitor mode to receive any of the frames types
|
||||||
|
*/
|
||||||
}tenuWifiFrameType;
|
}tenuWifiFrameType;
|
||||||
|
|
||||||
|
|
||||||
@ -105,7 +113,6 @@ typedef enum {
|
|||||||
tenuWifiFrameType
|
tenuWifiFrameType
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
||||||
/*!< Sub-Types related to Management Sub-Types */
|
/*!< Sub-Types related to Management Sub-Types */
|
||||||
ASSOC_REQ = 0x00,
|
ASSOC_REQ = 0x00,
|
||||||
ASSOC_RSP = 0x10,
|
ASSOC_RSP = 0x10,
|
||||||
@ -119,7 +126,6 @@ typedef enum {
|
|||||||
AUTH = 0xB0,
|
AUTH = 0xB0,
|
||||||
DEAUTH = 0xC0,
|
DEAUTH = 0xC0,
|
||||||
ACTION = 0xD0,
|
ACTION = 0xD0,
|
||||||
|
|
||||||
/**@{*/
|
/**@{*/
|
||||||
/* Sub-Types related to Control */
|
/* Sub-Types related to Control */
|
||||||
PS_POLL = 0xA4,
|
PS_POLL = 0xA4,
|
||||||
@ -146,7 +152,10 @@ typedef enum {
|
|||||||
QOS_DATA_POLL_ACK = 0xB8,
|
QOS_DATA_POLL_ACK = 0xB8,
|
||||||
QOS_NULL_FRAME = 0xC8,
|
QOS_NULL_FRAME = 0xC8,
|
||||||
QOS_CFPOLL = 0xE8,
|
QOS_CFPOLL = 0xE8,
|
||||||
QOS_CFPOLL_ACK = 0xF8
|
QOS_CFPOLL_ACK = 0xF8,
|
||||||
|
M2M_WIFI_FRAME_SUB_TYPE_ANY = 0xFF
|
||||||
|
/*!< Set monitor mode to receive any of the frames types
|
||||||
|
*/
|
||||||
}tenuSubTypes;
|
}tenuSubTypes;
|
||||||
|
|
||||||
|
|
||||||
@ -293,7 +302,7 @@ typedef enum {
|
|||||||
/*!< TPC Report
|
/*!< TPC Report
|
||||||
*/
|
*/
|
||||||
ISUPCHANNEL = 36,
|
ISUPCHANNEL = 36,
|
||||||
/*!< Supported channel list
|
/* Supported channel list
|
||||||
*/
|
*/
|
||||||
ICHSWANNOUNC = 37,
|
ICHSWANNOUNC = 37,
|
||||||
/*!< Channel Switch Announcement
|
/*!< Channel Switch Announcement
|
||||||
@ -562,6 +571,12 @@ typedef struct {
|
|||||||
/*!<
|
/*!<
|
||||||
Size of Receive Buffer for Ethernet Packet
|
Size of Receive Buffer for Ethernet Packet
|
||||||
*/
|
*/
|
||||||
|
uint8 u8EthernetEnable;
|
||||||
|
/*!<
|
||||||
|
Enable Ethernet mode flag
|
||||||
|
*/
|
||||||
|
uint8 __PAD8__;
|
||||||
|
|
||||||
} tstrEthInitParam;
|
} tstrEthInitParam;
|
||||||
/*!
|
/*!
|
||||||
@struct \
|
@struct \
|
||||||
@ -1082,7 +1097,6 @@ NMI_API sint8 m2m_wifi_stop_provision_mode(void);
|
|||||||
@sa
|
@sa
|
||||||
M2M_WIFI_RESP_CONN_INFO,
|
M2M_WIFI_RESP_CONN_INFO,
|
||||||
tstrM2MConnInfo
|
tstrM2MConnInfo
|
||||||
|
|
||||||
@return
|
@return
|
||||||
The function returns @ref M2M_SUCCESS for successful operations and a negative value otherwise.
|
The function returns @ref M2M_SUCCESS for successful operations and a negative value otherwise.
|
||||||
\section Example
|
\section Example
|
||||||
@ -2368,8 +2382,8 @@ NMI_API sint8 m2m_wifi_enable_sntp(uint8 bEnable);
|
|||||||
/**@{*/
|
/**@{*/
|
||||||
/*!
|
/*!
|
||||||
* @fn NMI_API sint8 m2m_wifi_set_sytem_time(uint32);
|
* @fn NMI_API sint8 m2m_wifi_set_sytem_time(uint32);
|
||||||
* @param [in] u32RTCSeconds
|
* @param [in] u32UTCSeconds
|
||||||
* UTC value in seconds.
|
* Seconds elapsed since January 1, 1900 (NTP Timestamp).
|
||||||
* @see m2m_wifi_enable_sntp
|
* @see m2m_wifi_enable_sntp
|
||||||
tstrSystemTime
|
tstrSystemTime
|
||||||
* @note If there is an RTC on the host MCU, the SNTP could be disabled and the host should set the system time to the firmware
|
* @note If there is an RTC on the host MCU, the SNTP could be disabled and the host should set the system time to the firmware
|
||||||
@ -2495,13 +2509,13 @@ sint8 m2m_wifi_enable_firmware_logs(uint8 u8Enable);
|
|||||||
*/
|
*/
|
||||||
sint8 m2m_wifi_set_battery_voltage(uint16 u16BattVoltx100);
|
sint8 m2m_wifi_set_battery_voltage(uint16 u16BattVoltx100);
|
||||||
/**
|
/**
|
||||||
* @fn m2m_wifi_get_firmware_version(tstrM2mRev* M2mRev)
|
* @fn m2m_wifi_get_firmware_version(tstrM2mRev* pstrRev)
|
||||||
* @brief Get Firmware version info
|
* @brief Get Firmware version info
|
||||||
* @param [out] M2mRev
|
* @param [out] M2mRev
|
||||||
* pointer holds address of structure "tstrM2mRev" that contains the firmware version parameters
|
* pointer holds address of structure "tstrM2mRev" that contains the firmware version parameters
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
sint8 m2m_wifi_get_firmware_version(tstrM2mRev *M2mRev);
|
sint8 m2m_wifi_get_firmware_version(tstrM2mRev *pstrRev);
|
||||||
/**@}*/
|
/**@}*/
|
||||||
#ifdef ETH_MODE
|
#ifdef ETH_MODE
|
||||||
/** @defgroup WifiEnableMacMcastFn m2m_wifi_enable_mac_mcast
|
/** @defgroup WifiEnableMacMcastFn m2m_wifi_enable_mac_mcast
|
||||||
@ -2545,9 +2559,18 @@ NMI_API sint8 m2m_wifi_enable_mac_mcast(uint8* pu8MulticastMacAddress, uint8 u8A
|
|||||||
*/
|
*/
|
||||||
NMI_API sint8 m2m_wifi_set_receive_buffer(void* pvBuffer,uint16 u16BufferLen);
|
NMI_API sint8 m2m_wifi_set_receive_buffer(void* pvBuffer,uint16 u16BufferLen);
|
||||||
/**@}*/
|
/**@}*/
|
||||||
#endif
|
#endif /* ETH_MODE */
|
||||||
|
/*!
|
||||||
|
* @fn sint8 m2m_wifi_prng_get_random_bytes(uint8 * pu8PRNGBuff,uint16 u16PRNGSize)
|
||||||
|
* @param [in] pu8PrngBuff
|
||||||
|
* Pointer to Buffer to receive data.
|
||||||
|
* Size greater than the maximum specified (@ref M2M_BUFFER_MAX_SIZE - sizeof(tstrPrng))
|
||||||
|
* causes a negative error @ref M2M_ERR_FAIL.
|
||||||
|
* @param [in] u16PrngSize
|
||||||
|
request size in bytes
|
||||||
|
* @return The function returns @ref M2M_SUCCESS for successful operations and a negative value otherwise.
|
||||||
|
*/
|
||||||
|
sint8 m2m_wifi_prng_get_random_bytes(uint8 * pu8PrngBuff,uint16 u16PrngSize);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -47,11 +47,13 @@
|
|||||||
#define NMI_CHIPID (NMI_PERIPH_REG_BASE)
|
#define NMI_CHIPID (NMI_PERIPH_REG_BASE)
|
||||||
#define rNMI_GP_REG_0 (0x149c)
|
#define rNMI_GP_REG_0 (0x149c)
|
||||||
#define rNMI_GP_REG_1 (0x14A0)
|
#define rNMI_GP_REG_1 (0x14A0)
|
||||||
|
#define rNMI_GP_REG_2 (0xc0008)
|
||||||
#define rNMI_GLB_RESET (0x1400)
|
#define rNMI_GLB_RESET (0x1400)
|
||||||
#define rNMI_BOOT_RESET_MUX (0x1118)
|
#define rNMI_BOOT_RESET_MUX (0x1118)
|
||||||
#define NMI_STATE_REG (0x108c)
|
#define NMI_STATE_REG (0x108c)
|
||||||
#define BOOTROM_REG (0xc000c)
|
#define BOOTROM_REG (0xc000c)
|
||||||
#define NMI_REV_REG (0x207ac) /*Also, Used to load ATE firmware from SPI Flash and to ensure that it is running too*/
|
#define NMI_REV_REG (0x207ac) /*Also, Used to load ATE firmware from SPI Flash and to ensure that it is running too*/
|
||||||
|
#define NMI_REV_REG_ATE (0x1048) /*Revision info register in case of ATE FW*/
|
||||||
#define M2M_WAIT_FOR_HOST_REG (0x207bc)
|
#define M2M_WAIT_FOR_HOST_REG (0x207bc)
|
||||||
#define M2M_FINISH_INIT_STATE 0x02532636UL
|
#define M2M_FINISH_INIT_STATE 0x02532636UL
|
||||||
#define M2M_FINISH_BOOT_ROM 0x10add09eUL
|
#define M2M_FINISH_BOOT_ROM 0x10add09eUL
|
||||||
@ -77,7 +79,12 @@
|
|||||||
#define rHAVE_EXT_PA_INV_TX_RX (NBIT4)
|
#define rHAVE_EXT_PA_INV_TX_RX (NBIT4)
|
||||||
#define rHAVE_LEGACY_RF_SETTINGS (NBIT5)
|
#define rHAVE_LEGACY_RF_SETTINGS (NBIT5)
|
||||||
#define rHAVE_LOGS_DISABLED_BIT (NBIT6)
|
#define rHAVE_LOGS_DISABLED_BIT (NBIT6)
|
||||||
|
#define rHAVE_ETHERNET_MODE_BIT (NBIT7)
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
uint32 u32Mac_efuse_mib;
|
||||||
|
uint32 u32Firmware_Ota_rev;
|
||||||
|
}tstrGpRegs;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@ -45,11 +45,11 @@
|
|||||||
#include "common/include/nm_common.h"
|
#include "common/include/nm_common.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @struct tstrM2mWifiGetRevision
|
* @struct tstrM2mRev
|
||||||
* @brief Structure holding firmware version parameters
|
* @brief Structure holding firmware version parameters and build date/time
|
||||||
* @sa M2M_WIFI_AUTH_WEB, M2M_WIFI_AUTH_WPA, M2M_WIFI_AUTH_WPA2
|
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
uint32 u32Chipid; /* HW revision which will be basically the chip ID */
|
||||||
uint8 u8FirmwareMajor; /* Version Major Number which represents the official release base */
|
uint8 u8FirmwareMajor; /* Version Major Number which represents the official release base */
|
||||||
uint8 u8FirmwareMinor; /* Version Minor Number which represents the engineering release base */
|
uint8 u8FirmwareMinor; /* Version Minor Number which represents the engineering release base */
|
||||||
uint8 u8FirmwarePatch; /* Version pathc Number which represents the pathces release base */
|
uint8 u8FirmwarePatch; /* Version pathc Number which represents the pathces release base */
|
||||||
@ -58,7 +58,7 @@ typedef struct {
|
|||||||
uint8 u8DriverPatch; /* Version Patch Number which represents the pathces release base */
|
uint8 u8DriverPatch; /* Version Patch Number which represents the pathces release base */
|
||||||
uint8 BuildDate[sizeof(__DATE__)];
|
uint8 BuildDate[sizeof(__DATE__)];
|
||||||
uint8 BuildTime[sizeof(__TIME__)];
|
uint8 BuildTime[sizeof(__TIME__)];
|
||||||
uint32 u32Chipid; /* HW revision which will be basically the chip ID */
|
uint8 _PAD8_;
|
||||||
} tstrM2mRev;
|
} tstrM2mRev;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -72,6 +72,23 @@ typedef struct {
|
|||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
sint8 nm_get_firmware_info(tstrM2mRev* M2mRev);
|
sint8 nm_get_firmware_info(tstrM2mRev* M2mRev);
|
||||||
|
/**
|
||||||
|
* @fn nm_get_firmware_full_info(tstrM2mRev* pstrRev)
|
||||||
|
* @brief Get Firmware version info
|
||||||
|
* @param [out] M2mRev
|
||||||
|
* pointer holds address of structure "tstrM2mRev" that contains the firmware version parameters
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
sint8 nm_get_firmware_full_info(tstrM2mRev* pstrRev);
|
||||||
|
/**
|
||||||
|
* @fn nm_get_ota_firmware_info(tstrM2mRev* pstrRev)
|
||||||
|
* @brief Get Firmware version info
|
||||||
|
* @param [out] M2mRev
|
||||||
|
* pointer holds address of structure "tstrM2mRev" that contains the firmware version parameters
|
||||||
|
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
sint8 nm_get_ota_firmware_info(tstrM2mRev* pstrRev);
|
||||||
/*
|
/*
|
||||||
* @fn nm_drv_init
|
* @fn nm_drv_init
|
||||||
* @brief Initialize NMC1000 driver
|
* @brief Initialize NMC1000 driver
|
||||||
|
|||||||
@ -176,7 +176,7 @@ MACROS
|
|||||||
|
|
||||||
#define SOCKET_CMD_PING 0x52
|
#define SOCKET_CMD_PING 0x52
|
||||||
|
|
||||||
|
#define SOCKET_CMD_SSL_SET_CS_LIST 0x53
|
||||||
|
|
||||||
|
|
||||||
#define PING_ERR_SUCCESS 0
|
#define PING_ERR_SUCCESS 0
|
||||||
@ -297,7 +297,11 @@ typedef struct{
|
|||||||
typedef struct{
|
typedef struct{
|
||||||
SOCKET sock;
|
SOCKET sock;
|
||||||
sint8 s8Error;
|
sint8 s8Error;
|
||||||
uint16 u16SessionID;
|
uint16 u16AppDataOffset;
|
||||||
|
/*!<
|
||||||
|
In further packet send requests the host interface should put the user application
|
||||||
|
data at this offset in the allocated shared data packet.
|
||||||
|
*/
|
||||||
}tstrConnectReply;
|
}tstrConnectReply;
|
||||||
|
|
||||||
|
|
||||||
@ -405,6 +409,11 @@ typedef struct{
|
|||||||
uint8 __PAD24__[3];
|
uint8 __PAD24__[3];
|
||||||
}tstrPingReply;
|
}tstrPingReply;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
uint32 u32CsBMP;
|
||||||
|
}tstrSslSetActiveCsList;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|||||||
@ -46,6 +46,13 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/** \defgroup SocketHeader Socket
|
||||||
|
* BSD alike socket interface beftween the host layer and the network
|
||||||
|
* protocol stacks in the firmware.
|
||||||
|
* These functions are used by the host application to send or receive
|
||||||
|
* packets and to do other socket operations.
|
||||||
|
*/
|
||||||
|
|
||||||
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
||||||
INCLUDES
|
INCLUDES
|
||||||
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
|
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
|
||||||
@ -55,15 +62,20 @@ INCLUDES
|
|||||||
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
||||||
MACROS
|
MACROS
|
||||||
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
|
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
|
||||||
/** @defgroup SocketDefines Defines
|
/**
|
||||||
|
* @defgroup SocketDefines Defines
|
||||||
* @ingroup SocketHeader
|
* @ingroup SocketHeader
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup IPDefines TCP/IP Defines
|
||||||
|
* @ingroup SocketDefines
|
||||||
* The following list of macros are used to define constants used throughout the socket layer.
|
* The following list of macros are used to define constants used throughout the socket layer.
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define HOSTNAME_MAX_SIZE 64
|
#define HOSTNAME_MAX_SIZE 64
|
||||||
/*!<
|
/*!<
|
||||||
Maximum allowed size for a host domain name passed to the function gethostbyname @ref gethostbyname.
|
Maximum allowed size for a host domain name passed to the function gethostbyname @ref gethostbyname.
|
||||||
command value. Used with the setsocketopt function.
|
command value. Used with the setsockopt function.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -116,45 +128,52 @@ MACROS
|
|||||||
#define SOL_SOCKET 1
|
#define SOL_SOCKET 1
|
||||||
/*!<
|
/*!<
|
||||||
Socket option.
|
Socket option.
|
||||||
Used with the @ref setsocketopt function
|
Used with the @ref setsockopt function
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define SOL_SSL_SOCKET 2
|
||||||
|
/*!<
|
||||||
|
SSL Socket option level.
|
||||||
|
Used with the @ref setsockopt function
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SO_SET_UDP_SEND_CALLBACK 0x00
|
#define SO_SET_UDP_SEND_CALLBACK 0x00
|
||||||
/*!<
|
/*!<
|
||||||
Socket option used by the application to enable/disable
|
Socket option used by the application to enable/disable
|
||||||
the use of UDP send callbacks.
|
the use of UDP send callbacks.
|
||||||
Used with the @ref setsocketopt function.
|
Used with the @ref setsockopt function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define IP_ADD_MEMBERSHIP 0x01
|
#define IP_ADD_MEMBERSHIP 0x01
|
||||||
/*!<
|
/*!<
|
||||||
Set Socket Option Add Membership command value.
|
Set Socket Option Add Membership command value.
|
||||||
Used with the @ref setsocketopt function.
|
Used with the @ref setsockopt function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define IP_DROP_MEMBERSHIP 0x02
|
#define IP_DROP_MEMBERSHIP 0x02
|
||||||
/*!<
|
/*!<
|
||||||
Set Socket Option Drop Membership command value.
|
Set Socket Option Drop Membership command value.
|
||||||
Used with the @ref setsocketopt function.
|
Used with the @ref setsockopt function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/** @defgroup SSLSocketOptions Defines
|
|
||||||
* @ingroup SocketHeader
|
/**
|
||||||
|
* @defgroup TLSDefines TLS Defines
|
||||||
|
* @ingroup SocketDefines
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** @defgroup SSLSocketOptions TLS Socket Options
|
||||||
|
* @ingroup TLSDefines
|
||||||
* The following list of macros are used to define SSL Socket options.
|
* The following list of macros are used to define SSL Socket options.
|
||||||
* @{
|
* @{
|
||||||
|
* @sa setsockopt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SOL_SSL_SOCKET 2
|
|
||||||
/*!<
|
|
||||||
SSL Socket option level.
|
|
||||||
Used with the @ref setsocketopt function
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#define SO_SSL_BYPASS_X509_VERIF 0x01
|
#define SO_SSL_BYPASS_X509_VERIF 0x01
|
||||||
/*!<
|
/*!<
|
||||||
Allow an opened SSL socket to bypass the X509 certificate
|
Allow an opened SSL socket to bypass the X509 certificate
|
||||||
@ -174,8 +193,78 @@ MACROS
|
|||||||
assocated with the connection. It must not exceed the size
|
assocated with the connection. It must not exceed the size
|
||||||
of HOSTNAME_MAX_SIZE.
|
of HOSTNAME_MAX_SIZE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define SO_SSL_ENABLE_SESSION_CACHING 0x03
|
||||||
|
/*!<
|
||||||
|
This option allow the TLS to cache the session information for fast
|
||||||
|
TLS session establishment in future connections using the
|
||||||
|
TLS Protocol session resume features.
|
||||||
|
*/
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** @defgroup SSLCipherSuiteConfiguration TLS Cipher Suite Configurations
|
||||||
|
* @ingroup TLSDefines
|
||||||
|
* The following list of macros are used to define SSL Ciphersuite Configuration.
|
||||||
|
* @sa sslSetActiveCipherSuites
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define SSL_ENABLE_ALL_SUITES 0xfffffffful
|
||||||
|
/*!<
|
||||||
|
Enable all possible supported cipher suites.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define SSL_ENABLE_RSA_SHA_SUITES 0x01
|
||||||
|
/*!<
|
||||||
|
Enable RSA Hmac_SHA based Ciphersuites. For example,
|
||||||
|
TLS_RSA_WITH_AES_128_CBC_SHA
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define SSL_ENABLE_RSA_SHA256_SUITES 0x02
|
||||||
|
/*!<
|
||||||
|
Enable RSA Hmac_SHA256 based Ciphersuites. For example,
|
||||||
|
TLS_RSA_WITH_AES_128_CBC_SHA256
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define SSL_ENABLE_DHE_SHA_SUITES 0x04
|
||||||
|
/*!<
|
||||||
|
Enable DHE Hmac_SHA based Ciphersuites. For example,
|
||||||
|
TLS_DHE_RSA_WITH_AES_128_CBC_SHA
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define SSL_ENABLE_DHE_SHA256_SUITES 0x08
|
||||||
|
/*!<
|
||||||
|
Enable DHE Hmac_SHA256 based Ciphersuites. For example,
|
||||||
|
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define SSL_ENABLE_RSA_GCM_SUITES 0x10
|
||||||
|
/*!<
|
||||||
|
Enable RSA AEAD based Ciphersuites. For example,
|
||||||
|
TLS_RSA_WITH_AES_128_GCM_SHA256
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define SSL_ENABLE_DHE_GCM_SUITES 0x20
|
||||||
|
/*!<
|
||||||
|
Enable DHE AEAD based Ciphersuites. For example,
|
||||||
|
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
|
||||||
|
*/
|
||||||
|
|
||||||
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**************
|
/**************
|
||||||
Socket Errors
|
Socket Errors
|
||||||
**************/
|
**************/
|
||||||
@ -190,6 +279,7 @@ Socket Errors
|
|||||||
Successfull socket operation
|
Successfull socket operation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define SOCK_ERR_INVALID_ADDRESS -1
|
#define SOCK_ERR_INVALID_ADDRESS -1
|
||||||
/*!<
|
/*!<
|
||||||
Socket address is invalid. The socket operation cannot be completed successfully without specifying a specific address
|
Socket address is invalid. The socket operation cannot be completed successfully without specifying a specific address
|
||||||
@ -221,7 +311,7 @@ Socket Errors
|
|||||||
|
|
||||||
#define SOCK_ERR_INVALID_ARG -6
|
#define SOCK_ERR_INVALID_ARG -6
|
||||||
/*!<
|
/*!<
|
||||||
An invalid argument is passed to a function.
|
An invalid arguement is passed to a function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -303,6 +393,10 @@ Socket Errors
|
|||||||
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
||||||
DATA TYPES
|
DATA TYPES
|
||||||
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
|
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
|
||||||
|
/** @defgroup SocketEnums Enumeration-Typedef
|
||||||
|
* @ingroup SocketHeader
|
||||||
|
* Specific Enumuration-typdefs used for socket operations
|
||||||
|
* @{ */
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@typedef \
|
@typedef \
|
||||||
@ -316,10 +410,6 @@ DATA TYPES
|
|||||||
typedef sint8 SOCKET;
|
typedef sint8 SOCKET;
|
||||||
|
|
||||||
|
|
||||||
/** @defgroup SocketEnums Enumeration-Typedef
|
|
||||||
* @ingroup SocketHeader
|
|
||||||
* Specific Enumuration-typdefs used for socket operations
|
|
||||||
* @{ */
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@struct \
|
@struct \
|
||||||
@ -370,7 +460,6 @@ Socket address family.
|
|||||||
@brief
|
@brief
|
||||||
Socket address structure for IPV4 addresses. Used to specify socket address infomation to which to connect to.
|
Socket address structure for IPV4 addresses. Used to specify socket address infomation to which to connect to.
|
||||||
Can be cast to @ref sockaddr structure.
|
Can be cast to @ref sockaddr structure.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
struct sockaddr_in{
|
struct sockaddr_in{
|
||||||
uint16 sin_family;
|
uint16 sin_family;
|
||||||
@ -590,7 +679,6 @@ typedef struct{
|
|||||||
}tstrSocketRecvMsg;
|
}tstrSocketRecvMsg;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@typedef \
|
@typedef \
|
||||||
tpfAppSocketCb
|
tpfAppSocketCb
|
||||||
@ -817,7 +905,6 @@ NMI_API void socketDeinit(void);
|
|||||||
m2m_wifi_connect((char *)MAIN_WLAN_SSID, sizeof(MAIN_WLAN_SSID), MAIN_WLAN_AUTH, (char *)MAIN_WLAN_PSK, M2M_WIFI_CH_ALL);
|
m2m_wifi_connect((char *)MAIN_WLAN_SSID, sizeof(MAIN_WLAN_SSID), MAIN_WLAN_AUTH, (char *)MAIN_WLAN_PSK, M2M_WIFI_CH_ALL);
|
||||||
\endcode
|
\endcode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
NMI_API void registerSocketCallback(tpfAppSocketCb socket_cb, tpfAppResolveCb resolve_cb);
|
NMI_API void registerSocketCallback(tpfAppSocketCb socket_cb, tpfAppResolveCb resolve_cb);
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
@ -1642,7 +1729,7 @@ NMI_API uint32 nmi_inet_addr(char *pcIpAddr);
|
|||||||
|
|
||||||
@see
|
@see
|
||||||
registerSocketCallback
|
registerSocketCallback
|
||||||
)
|
|
||||||
@warning
|
@warning
|
||||||
Successful completion of a call to gethostbyname() does not guarantee success of the DNS request,
|
Successful completion of a call to gethostbyname() does not guarantee success of the DNS request,
|
||||||
a negative return value indicates only locally-detected errors
|
a negative return value indicates only locally-detected errors
|
||||||
@ -1653,7 +1740,46 @@ NMI_API uint32 nmi_inet_addr(char *pcIpAddr);
|
|||||||
*/
|
*/
|
||||||
NMI_API sint8 WINC1500_EXPORT(gethostbyname)(uint8 * pcHostName);
|
NMI_API sint8 WINC1500_EXPORT(gethostbyname)(uint8 * pcHostName);
|
||||||
|
|
||||||
NMI_API sint8 sslSetSockOpt(SOCKET sock, uint8 u8Opt, const void *pvOptVal, uint16 u16OptLen);
|
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
/** @defgroup sslSetActiveCipherSuitesFn sslSetActiveCipherSuites
|
||||||
|
* @ingroup SocketAPI
|
||||||
|
* Overrides the default active SSL ciphers in the SSL module with a certain combination of ciphers selected by the caller using
|
||||||
|
* a bitmap containing the required ciphers list.
|
||||||
|
* There API is required only if the will not change the default ciphersuites, otherwise, it is not recommended to use.
|
||||||
|
*/
|
||||||
|
/**@{*/
|
||||||
|
/*!
|
||||||
|
@fn \
|
||||||
|
NMI_API sint8 sslSetActiveCipherSuites(uint32 u32SslCsBMP);
|
||||||
|
|
||||||
|
@param [in] u32SslCsBMP
|
||||||
|
<p>A non-zero 32-bit integer bitmap containing the bitwise OR of the desired ciphers to be enabled
|
||||||
|
for the SSL module. The ciphersuites are defined in groups as follows:</p>
|
||||||
|
<ul>
|
||||||
|
<li>@ref SSL_ENABLE_ALL_SUITES</li>
|
||||||
|
<li>@ref SSL_ENABLE_RSA_SHA_SUITES</li>
|
||||||
|
<li>@ref SSL_ENABLE_RSA_SHA256_SUITES</li>
|
||||||
|
<li>@ref SSL_ENABLE_DHE_SHA_SUITES</li>
|
||||||
|
<li>@ref SSL_ENABLE_DHE_SHA256_SUITES</li>
|
||||||
|
<li>@ref SSL_ENABLE_RSA_GCM_SUITES</li>
|
||||||
|
<li>@ref SSL_ENABLE_DHE_GCM_SUITES</li>
|
||||||
|
</ul>
|
||||||
|
@return
|
||||||
|
Possible return values are [SOCK_ERR_NO_ERROR](@ref SOCK_ERR_NO_ERROR) if case of success
|
||||||
|
or [SOCK_ERR_INVALID_ARG](@ref SOCK_ERR_INVALID_ARG) if the map is zero.
|
||||||
|
@remarks
|
||||||
|
The default supported ciphersuites are the combination of all the above groups. The caller can override the default with any desired combination.
|
||||||
|
For example, to disable SHA based ciphers the function should be called with this syntax:
|
||||||
|
\code
|
||||||
|
sslSetActiveCipherSuites(SSL_ENABLE_ALL_SUITES & ~(SSL_ENABLE_RSA_SHA_SUITES|SSL_ENABLE_DHE_SHA_SUITES));
|
||||||
|
\endcode
|
||||||
|
@note Passing the u32SslCsBMP as zero <strong>will not</strong> change the current active list.
|
||||||
|
*/
|
||||||
|
NMI_API sint8 sslSetActiveCipherSuites(uint32 u32SslCsBMP);
|
||||||
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/** @defgroup SetSocketOptionFn setsockopt
|
/** @defgroup SetSocketOptionFn setsockopt
|
||||||
@ -1662,20 +1788,53 @@ NMI_API sint8 sslSetSockOpt(SOCKET sock, uint8 u8Opt, const void *pvOptVal, uin
|
|||||||
* argument, at the protocol level specified by the level argument, to the value
|
* argument, at the protocol level specified by the level argument, to the value
|
||||||
* pointed to by the option_value argument for the socke specified by the socket argument.
|
* pointed to by the option_value argument for the socke specified by the socket argument.
|
||||||
*
|
*
|
||||||
* Possible Options:
|
* <p>Possible protcol level values supported are @ref SOL_SOCKET and @ref SOL_SSL_SOCKET.
|
||||||
* SO_SET_UDP_SEND_CALLBACK:
|
* Possible options when the protocol level is @ref SOL_SOCKET :</p>
|
||||||
* Enable/Disable callback messages for sendto().Since UDP is unreliable by default the user maybe interested (or not)
|
* <table style="width: 100%">
|
||||||
* in receiving a message of /ref SOCKET_MSG_SENDTO for each call of sendto().
|
* <tr>
|
||||||
* Enabled if option_value equals /ref BTRUE Disabled otherwise.
|
* <td style="height: 22px"><strong>@ref SO_SET_UDP_SEND_CALLBACK</strong></td>
|
||||||
* IP_ADD_MEMBERSHIP:
|
* <td style="height: 22px">Enable/Disable callback messages for sendto().
|
||||||
* valid for UDP sockets,this option is used to receive frames sent to a multicast group.
|
* Since UDP is unreliable by default the user maybe interested (or not) in
|
||||||
* option_value shall be a pointer to Unsigned 32 bit integer containing the Multicast ipv4 address.
|
* receiving a message of @ref SOCKET_MSG_SENDTO for each call of sendto().
|
||||||
* IP_DROP_MEMBERSHIP:
|
* Enabled if option value equals @ref TRUE, disabled otherwise.</td>
|
||||||
* valid for UDP sockets,this option is used to Stop receiving frames sent to a multicast group.
|
* </tr>
|
||||||
* option_value shall be a pointer to Unsigned 32 bit integer containing the Multicast ipv4 address.
|
* <tr>
|
||||||
*
|
* <td><strong>@ref IP_ADD_MEMBERSHIP</strong></td>
|
||||||
* Possible values for s32Level:
|
* <td>Valid for UDP sockets. This option is used to receive frames sent to
|
||||||
* This argument is ignored.
|
* a multicast group. option_value shall be a pointer to Unsigned 32-bit
|
||||||
|
* integer containing the multicast IPv4 address. </td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td><strong>@ref IP_DROP_MEMBERSHIP</strong></td>
|
||||||
|
* <td>Valid for UDP sockets. This option is used to stop receiving frames
|
||||||
|
* sent to a multicast group. option_value shall be a pointer to Unsigned
|
||||||
|
* 32-bit integer containing the multicast IPv4 address.</td>
|
||||||
|
* </tr>
|
||||||
|
* </table>
|
||||||
|
* <p>Possible options when the protcol leve is @ref SOL_SSL_SOCKET</p>
|
||||||
|
* <table style="width: 100%">
|
||||||
|
* <tr>
|
||||||
|
* <td style="height: 22px"><strong>
|
||||||
|
* @ref SO_SSL_BYPASS_X509_VERIF</strong></td>
|
||||||
|
* <td style="height: 22px">Allow an opened SSL socket to bypass the X509
|
||||||
|
* certificate verification process. It is highly recommended <strong>NOT</strong> to use
|
||||||
|
* this socket option in production software applications. The option is
|
||||||
|
* supported for debugging and testing purposes. The option value should be
|
||||||
|
* casted to int type and it is handled as a boolean flag.</td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td><strong>@ref SO_SSL_SNI</strong></td>
|
||||||
|
* <td>Set the Server Name Indicator (SNI) for an SSL socket. The SNI is a
|
||||||
|
* null terminated string containing the server name assocated with the
|
||||||
|
* connection. It must not exceed the size of @ref HOSTNAME_MAX_SIZE.</td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td><strong>@ref SO_SSL_ENABLE_SESSION_CACHING</strong></td>
|
||||||
|
* <td>This option allow the TLS to cache the session information for fast
|
||||||
|
* TLS session establishment in future connections using the TLS Protocol
|
||||||
|
* session resume features.</td>
|
||||||
|
* </tr>
|
||||||
|
* </table>
|
||||||
*/
|
*/
|
||||||
/**@{*/
|
/**@{*/
|
||||||
/*!
|
/*!
|
||||||
@ -1687,25 +1846,25 @@ NMI_API sint8 sslSetSockOpt(SOCKET sock, uint8 u8Opt, const void *pvOptVal, uin
|
|||||||
Socket handler.
|
Socket handler.
|
||||||
|
|
||||||
@param [in] level
|
@param [in] level
|
||||||
protocol level. always SOL_SOCKET for now.
|
protocol level. See description above.
|
||||||
|
|
||||||
@param [in] option_name
|
@param [in] option_name
|
||||||
option to be set.
|
option to be set. See description above.
|
||||||
|
|
||||||
@param [in] option_value
|
@param [in] option_value
|
||||||
pointer to user provided value.
|
pointer to user provided value.
|
||||||
|
|
||||||
@param [in] option_len
|
@param [in] option_len
|
||||||
length of the option value.
|
length of the option value in bytes.
|
||||||
@warning
|
|
||||||
-Note that sending IGMP packets to Join/Leave multicast groups is not implemented at the current moment. \n
|
|
||||||
calling this function will Pass/Filter packets packets sent to Multicast address provided in the option_value
|
|
||||||
@return
|
@return
|
||||||
The function shall return \ref SOCK_ERR_NO_ERROR for successful operation
|
The function shall return \ref SOCK_ERR_NO_ERROR for successful operation
|
||||||
and a negative value (indicating the error) otherwise.
|
and a negative value (indicating the error) otherwise.
|
||||||
|
@sa SOL_SOCKET, SOL_SSL_SOCKET,
|
||||||
*/
|
*/
|
||||||
NMI_API sint8 WINC1500_EXPORT(setsockopt)(SOCKET socket, uint8 u8Level, uint8 option_name,
|
NMI_API sint8 WINC1500_EXPORT(setsockopt)(SOCKET socket, uint8 u8Level, uint8 option_name,
|
||||||
const void *option_value, uint16 u16OptionLen);
|
const void *option_value, uint16 u16OptionLen);
|
||||||
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
/** @defgroup GetSocketOptionsFn getsockopt
|
/** @defgroup GetSocketOptionsFn getsockopt
|
||||||
* @ingroup SocketAPI
|
* @ingroup SocketAPI
|
||||||
|
|||||||
@ -133,13 +133,32 @@ FUNCTION IMPLEMENTATION
|
|||||||
sint8 m2m_ate_init(void)
|
sint8 m2m_ate_init(void)
|
||||||
{
|
{
|
||||||
sint8 s8Ret = M2M_SUCCESS;
|
sint8 s8Ret = M2M_SUCCESS;
|
||||||
uint8 u8WifiMode = M2M_WIFI_MODE_CONFIG;
|
uint8 u8WifiMode = M2M_WIFI_MODE_ATE_HIGH;
|
||||||
|
|
||||||
s8Ret = nm_drv_init(&u8WifiMode);
|
s8Ret = nm_drv_init(&u8WifiMode);
|
||||||
|
|
||||||
return s8Ret;
|
return s8Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@fn \
|
||||||
|
sint8 m2m_ate_init(tstrM2mAteInit *pstrInit);
|
||||||
|
|
||||||
|
@brief
|
||||||
|
This function used to download ATE firmware from flash and start it
|
||||||
|
|
||||||
|
@return
|
||||||
|
The function SHALL return 0 for success and a negative value otherwise.
|
||||||
|
*/
|
||||||
|
sint8 m2m_ate_init_param(tstrM2mAteInit *pstrInit)
|
||||||
|
{
|
||||||
|
sint8 s8Ret = M2M_SUCCESS;
|
||||||
|
|
||||||
|
s8Ret = nm_drv_init((void*)&pstrInit->u8RxPwrMode);
|
||||||
|
|
||||||
|
return s8Ret;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@fn \
|
@fn \
|
||||||
sint8 m2m_ate_deinit(void);
|
sint8 m2m_ate_deinit(void);
|
||||||
|
|||||||
1010
src/winc1500/src/m2m_crypto.c
Normal file
1010
src/winc1500/src/m2m_crypto.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -77,7 +77,9 @@ static volatile uint8 gu8Interrupt = 0;
|
|||||||
tpfHifCallBack pfWifiCb = NULL; /*!< pointer to Wi-Fi call back function */
|
tpfHifCallBack pfWifiCb = NULL; /*!< pointer to Wi-Fi call back function */
|
||||||
tpfHifCallBack pfIpCb = NULL; /*!< pointer to Socket call back function */
|
tpfHifCallBack pfIpCb = NULL; /*!< pointer to Socket call back function */
|
||||||
tpfHifCallBack pfOtaCb = NULL; /*!< pointer to OTA call back function */
|
tpfHifCallBack pfOtaCb = NULL; /*!< pointer to OTA call back function */
|
||||||
|
tpfHifCallBack pfSigmaCb = NULL;
|
||||||
tpfHifCallBack pfHifCb = NULL;
|
tpfHifCallBack pfHifCb = NULL;
|
||||||
|
tpfHifCallBack pfCryptoCb = NULL;
|
||||||
|
|
||||||
static void isr(void)
|
static void isr(void)
|
||||||
{
|
{
|
||||||
@ -245,7 +247,7 @@ sint8 hif_init(void * arg)
|
|||||||
gu8Interrupt = 0;
|
gu8Interrupt = 0;
|
||||||
nm_bsp_register_isr(isr);
|
nm_bsp_register_isr(isr);
|
||||||
|
|
||||||
hif_register_cb(M2M_REQ_GRP_HIF,m2m_hif_cb);
|
hif_register_cb(M2M_REQ_GROUP_HIF,m2m_hif_cb);
|
||||||
|
|
||||||
return M2M_SUCCESS;
|
return M2M_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -370,11 +372,17 @@ sint8 hif_send(uint8 u8Gid,uint8 u8Opcode,uint8 *pu8CtrlBuf,uint16 u16CtrlBufSiz
|
|||||||
u32CurrAddr = dma_addr;
|
u32CurrAddr = dma_addr;
|
||||||
strHif.u16Length=NM_BSP_B_L_16(strHif.u16Length);
|
strHif.u16Length=NM_BSP_B_L_16(strHif.u16Length);
|
||||||
ret = nm_write_block(u32CurrAddr, (uint8*)&strHif, M2M_HIF_HDR_OFFSET);
|
ret = nm_write_block(u32CurrAddr, (uint8*)&strHif, M2M_HIF_HDR_OFFSET);
|
||||||
|
#ifdef CONF_WINC_USE_I2C
|
||||||
|
nm_bsp_sleep(1);
|
||||||
|
#endif
|
||||||
if(M2M_SUCCESS != ret) goto ERR1;
|
if(M2M_SUCCESS != ret) goto ERR1;
|
||||||
u32CurrAddr += M2M_HIF_HDR_OFFSET;
|
u32CurrAddr += M2M_HIF_HDR_OFFSET;
|
||||||
if(pu8CtrlBuf != NULL)
|
if(pu8CtrlBuf != NULL)
|
||||||
{
|
{
|
||||||
ret = nm_write_block(u32CurrAddr, pu8CtrlBuf, u16CtrlBufSize);
|
ret = nm_write_block(u32CurrAddr, pu8CtrlBuf, u16CtrlBufSize);
|
||||||
|
#ifdef CONF_WINC_USE_I2C
|
||||||
|
nm_bsp_sleep(1);
|
||||||
|
#endif
|
||||||
if(M2M_SUCCESS != ret) goto ERR1;
|
if(M2M_SUCCESS != ret) goto ERR1;
|
||||||
u32CurrAddr += u16CtrlBufSize;
|
u32CurrAddr += u16CtrlBufSize;
|
||||||
}
|
}
|
||||||
@ -382,6 +390,9 @@ sint8 hif_send(uint8 u8Gid,uint8 u8Opcode,uint8 *pu8CtrlBuf,uint16 u16CtrlBufSiz
|
|||||||
{
|
{
|
||||||
u32CurrAddr += (u16DataOffset - u16CtrlBufSize);
|
u32CurrAddr += (u16DataOffset - u16CtrlBufSize);
|
||||||
ret = nm_write_block(u32CurrAddr, pu8DataBuf, u16DataSize);
|
ret = nm_write_block(u32CurrAddr, pu8DataBuf, u16DataSize);
|
||||||
|
#ifdef CONF_WINC_USE_I2C
|
||||||
|
nm_bsp_sleep(1);
|
||||||
|
#endif
|
||||||
if(M2M_SUCCESS != ret) goto ERR1;
|
if(M2M_SUCCESS != ret) goto ERR1;
|
||||||
u32CurrAddr += u16DataSize;
|
u32CurrAddr += u16DataSize;
|
||||||
}
|
}
|
||||||
@ -426,7 +437,7 @@ static sint8 hif_isr(void)
|
|||||||
ret = hif_chip_wake();
|
ret = hif_chip_wake();
|
||||||
if(ret == M2M_SUCCESS)
|
if(ret == M2M_SUCCESS)
|
||||||
{
|
{
|
||||||
ret = nm_read_reg_with_ret(0x1070, ®);
|
ret = nm_read_reg_with_ret(WIFI_HOST_RCV_CTRL_0, ®);
|
||||||
if(M2M_SUCCESS == ret)
|
if(M2M_SUCCESS == ret)
|
||||||
{
|
{
|
||||||
if(reg & 0x1) /* New interrupt has been received */
|
if(reg & 0x1) /* New interrupt has been received */
|
||||||
@ -435,19 +446,9 @@ static sint8 hif_isr(void)
|
|||||||
|
|
||||||
nm_bsp_interrupt_ctrl(0);
|
nm_bsp_interrupt_ctrl(0);
|
||||||
/*Clearing RX interrupt*/
|
/*Clearing RX interrupt*/
|
||||||
ret = nm_read_reg_with_ret(WIFI_HOST_RCV_CTRL_0,®);
|
|
||||||
if(ret != M2M_SUCCESS)goto ERR1;
|
|
||||||
reg &= ~(1<<0);
|
reg &= ~(1<<0);
|
||||||
ret = nm_write_reg(WIFI_HOST_RCV_CTRL_0,reg);
|
ret = nm_write_reg(WIFI_HOST_RCV_CTRL_0,reg);
|
||||||
if(ret != M2M_SUCCESS)goto ERR1;
|
if(ret != M2M_SUCCESS)goto ERR1;
|
||||||
/* read the rx size */
|
|
||||||
ret = nm_read_reg_with_ret(WIFI_HOST_RCV_CTRL_0, ®);
|
|
||||||
if(M2M_SUCCESS != ret)
|
|
||||||
{
|
|
||||||
M2M_ERR("(hif) WIFI_HOST_RCV_CTRL_0 bus fail\n");
|
|
||||||
nm_bsp_interrupt_ctrl(1);
|
|
||||||
goto ERR1;
|
|
||||||
}
|
|
||||||
gu8HifSizeDone = 0;
|
gu8HifSizeDone = 0;
|
||||||
size = (uint16)((reg >> 2) & 0xfff);
|
size = (uint16)((reg >> 2) & 0xfff);
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
@ -482,22 +483,32 @@ static sint8 hif_isr(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(M2M_REQ_GRP_WIFI == strHif.u8Gid)
|
if(M2M_REQ_GROUP_WIFI == strHif.u8Gid)
|
||||||
{
|
{
|
||||||
if(pfWifiCb)
|
if(pfWifiCb)
|
||||||
pfWifiCb(strHif.u8Opcode,strHif.u16Length - M2M_HIF_HDR_OFFSET, address + M2M_HIF_HDR_OFFSET);
|
pfWifiCb(strHif.u8Opcode,strHif.u16Length - M2M_HIF_HDR_OFFSET, address + M2M_HIF_HDR_OFFSET);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(M2M_REQ_GRP_IP == strHif.u8Gid)
|
else if(M2M_REQ_GROUP_IP == strHif.u8Gid)
|
||||||
{
|
{
|
||||||
if(pfIpCb)
|
if(pfIpCb)
|
||||||
pfIpCb(strHif.u8Opcode,strHif.u16Length - M2M_HIF_HDR_OFFSET, address + M2M_HIF_HDR_OFFSET);
|
pfIpCb(strHif.u8Opcode,strHif.u16Length - M2M_HIF_HDR_OFFSET, address + M2M_HIF_HDR_OFFSET);
|
||||||
}
|
}
|
||||||
else if(M2M_REQ_GRP_OTA == strHif.u8Gid)
|
else if(M2M_REQ_GROUP_OTA == strHif.u8Gid)
|
||||||
{
|
{
|
||||||
if(pfOtaCb)
|
if(pfOtaCb)
|
||||||
pfOtaCb(strHif.u8Opcode,strHif.u16Length - M2M_HIF_HDR_OFFSET, address + M2M_HIF_HDR_OFFSET);
|
pfOtaCb(strHif.u8Opcode,strHif.u16Length - M2M_HIF_HDR_OFFSET, address + M2M_HIF_HDR_OFFSET);
|
||||||
}
|
}
|
||||||
|
else if(M2M_REQ_GROUP_CRYPTO == strHif.u8Gid)
|
||||||
|
{
|
||||||
|
if(pfCryptoCb)
|
||||||
|
pfCryptoCb(strHif.u8Opcode,strHif.u16Length - M2M_HIF_HDR_OFFSET, address + M2M_HIF_HDR_OFFSET);
|
||||||
|
}
|
||||||
|
else if(M2M_REQ_GROUP_SIGMA == strHif.u8Gid)
|
||||||
|
{
|
||||||
|
if(pfSigmaCb)
|
||||||
|
pfSigmaCb(strHif.u8Opcode,strHif.u16Length - M2M_HIF_HDR_OFFSET, address + M2M_HIF_HDR_OFFSET);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
M2M_ERR("(hif) invalid group ID\n");
|
M2M_ERR("(hif) invalid group ID\n");
|
||||||
@ -600,9 +611,11 @@ sint8 hif_receive(uint32 u32Addr, uint8 *pu8Buf, uint16 u16Sz, uint8 isDone)
|
|||||||
/* set RX done */
|
/* set RX done */
|
||||||
ret = hif_set_rx_done();
|
ret = hif_set_rx_done();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ret = M2M_ERR_FAIL;
|
ret = M2M_ERR_FAIL;
|
||||||
M2M_ERR(" hif_receive: Invalid argument\n");
|
M2M_ERR(" hif_receive: Invalid argument\n");
|
||||||
|
}
|
||||||
goto ERR1;
|
goto ERR1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -614,9 +627,6 @@ sint8 hif_receive(uint32 u32Addr, uint8 *pu8Buf, uint16 u16Sz, uint8 isDone)
|
|||||||
ret = nm_read_reg_with_ret(WIFI_HOST_RCV_CTRL_1,&address);
|
ret = nm_read_reg_with_ret(WIFI_HOST_RCV_CTRL_1,&address);
|
||||||
if(ret != M2M_SUCCESS)goto ERR1;
|
if(ret != M2M_SUCCESS)goto ERR1;
|
||||||
|
|
||||||
/* Receive the payload */
|
|
||||||
ret = nm_read_block(u32Addr, pu8Buf, u16Sz);
|
|
||||||
if(ret != M2M_SUCCESS)goto ERR1;
|
|
||||||
|
|
||||||
if(u16Sz > size)
|
if(u16Sz > size)
|
||||||
{
|
{
|
||||||
@ -631,6 +641,10 @@ sint8 hif_receive(uint32 u32Addr, uint8 *pu8Buf, uint16 u16Sz, uint8 isDone)
|
|||||||
goto ERR1;
|
goto ERR1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Receive the payload */
|
||||||
|
ret = nm_read_block(u32Addr, pu8Buf, u16Sz);
|
||||||
|
if(ret != M2M_SUCCESS)goto ERR1;
|
||||||
|
|
||||||
/* check if this is the last packet */
|
/* check if this is the last packet */
|
||||||
if((((address + size) - (u32Addr + u16Sz)) <= 0) || isDone)
|
if((((address + size) - (u32Addr + u16Sz)) <= 0) || isDone)
|
||||||
{
|
{
|
||||||
@ -661,18 +675,24 @@ sint8 hif_register_cb(uint8 u8Grp,tpfHifCallBack fn)
|
|||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
switch(u8Grp)
|
switch(u8Grp)
|
||||||
{
|
{
|
||||||
case M2M_REQ_GRP_IP:
|
case M2M_REQ_GROUP_IP:
|
||||||
pfIpCb = fn;
|
pfIpCb = fn;
|
||||||
break;
|
break;
|
||||||
case M2M_REQ_GRP_WIFI:
|
case M2M_REQ_GROUP_WIFI:
|
||||||
pfWifiCb = fn;
|
pfWifiCb = fn;
|
||||||
break;
|
break;
|
||||||
case M2M_REQ_GRP_OTA:
|
case M2M_REQ_GROUP_OTA:
|
||||||
pfOtaCb = fn;
|
pfOtaCb = fn;
|
||||||
break;
|
break;
|
||||||
case M2M_REQ_GRP_HIF:
|
case M2M_REQ_GROUP_HIF:
|
||||||
pfHifCb = fn;
|
pfHifCb = fn;
|
||||||
break;
|
break;
|
||||||
|
case M2M_REQ_GROUP_CRYPTO:
|
||||||
|
pfCryptoCb = fn;
|
||||||
|
break;
|
||||||
|
case M2M_REQ_GROUP_SIGMA:
|
||||||
|
pfSigmaCb = fn;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
M2M_ERR("GRp ? %d\n",u8Grp);
|
M2M_ERR("GRp ? %d\n",u8Grp);
|
||||||
ret = M2M_ERR_FAIL;
|
ret = M2M_ERR_FAIL;
|
||||||
|
|||||||
@ -44,7 +44,6 @@
|
|||||||
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
||||||
INCLUDES
|
INCLUDES
|
||||||
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
|
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
|
||||||
|
|
||||||
#include "common/include/nm_common.h"
|
#include "common/include/nm_common.h"
|
||||||
#include "driver/include/m2m_types.h"
|
#include "driver/include/m2m_types.h"
|
||||||
#include "driver/include/m2m_ota.h"
|
#include "driver/include/m2m_ota.h"
|
||||||
@ -140,7 +139,7 @@ NMI_API sint8 m2m_ota_init(tpfOtaUpdateCb pfOtaUpdateCb, tpfOtaNotifCb pfOtaNot
|
|||||||
M2M_ERR("Invaild Ota notify cb\n");
|
M2M_ERR("Invaild Ota notify cb\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
hif_register_cb(M2M_REQ_GRP_OTA,m2m_ota_cb);
|
hif_register_cb(M2M_REQ_GROUP_OTA,m2m_ota_cb);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -164,7 +163,7 @@ NMI_API sint8 m2m_ota_notif_set_url(uint8 * u8Url)
|
|||||||
/*Todo: we may change it to data pkt but we need to give it higer priority
|
/*Todo: we may change it to data pkt but we need to give it higer priority
|
||||||
but the priorty is not implemnted yet in data pkt
|
but the priorty is not implemnted yet in data pkt
|
||||||
*/
|
*/
|
||||||
ret = hif_send(M2M_REQ_GRP_OTA,M2M_OTA_REQ_START_UPDATE,u8Url,u16UrlSize,NULL,0,0);
|
ret = hif_send(M2M_REQ_GROUP_OTA,M2M_OTA_REQ_START_UPDATE,u8Url,u16UrlSize,NULL,0,0);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -182,7 +181,7 @@ NMI_API sint8 m2m_ota_notif_set_url(uint8 * u8Url)
|
|||||||
NMI_API sint8 m2m_ota_notif_check_for_update(void)
|
NMI_API sint8 m2m_ota_notif_check_for_update(void)
|
||||||
{
|
{
|
||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
ret = hif_send(M2M_REQ_GRP_OTA,M2M_OTA_REQ_NOTIF_CHECK_FOR_UPDATE,NULL,0,NULL,0,0);
|
ret = hif_send(M2M_REQ_GROUP_OTA,M2M_OTA_REQ_NOTIF_CHECK_FOR_UPDATE,NULL,0,NULL,0,0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +201,7 @@ NMI_API sint8 m2m_ota_notif_check_for_update(void)
|
|||||||
NMI_API sint8 m2m_ota_notif_sched(uint32 u32Period)
|
NMI_API sint8 m2m_ota_notif_sched(uint32 u32Period)
|
||||||
{
|
{
|
||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
ret = hif_send(M2M_REQ_GRP_OTA,M2M_OTA_REQ_NOTIF_CHECK_FOR_UPDATE,NULL,0,NULL,0,0);
|
ret = hif_send(M2M_REQ_GROUP_OTA,M2M_OTA_REQ_NOTIF_CHECK_FOR_UPDATE,NULL,0,NULL,0,0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +226,7 @@ NMI_API sint8 m2m_ota_start_update(uint8 * u8DownloadUrl)
|
|||||||
/*Todo: we may change it to data pkt but we need to give it higer priority
|
/*Todo: we may change it to data pkt but we need to give it higer priority
|
||||||
but the priorty is not implemnted yet in data pkt
|
but the priorty is not implemnted yet in data pkt
|
||||||
*/
|
*/
|
||||||
ret = hif_send(M2M_REQ_GRP_OTA,M2M_OTA_REQ_START_UPDATE,u8DownloadUrl,u16DurlSize,NULL,0,0);
|
ret = hif_send(M2M_REQ_GROUP_OTA,M2M_OTA_REQ_START_UPDATE,u8DownloadUrl,u16DurlSize,NULL,0,0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,7 +244,7 @@ NMI_API sint8 m2m_ota_start_update(uint8 * u8DownloadUrl)
|
|||||||
NMI_API sint8 m2m_ota_rollback(void)
|
NMI_API sint8 m2m_ota_rollback(void)
|
||||||
{
|
{
|
||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
ret = hif_send(M2M_REQ_GRP_OTA,M2M_OTA_REQ_ROLLBACK,NULL,0,NULL,0,0);
|
ret = hif_send(M2M_REQ_GROUP_OTA,M2M_OTA_REQ_ROLLBACK,NULL,0,NULL,0,0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,7 +262,28 @@ NMI_API sint8 m2m_ota_rollback(void)
|
|||||||
NMI_API sint8 m2m_ota_switch_firmware(void)
|
NMI_API sint8 m2m_ota_switch_firmware(void)
|
||||||
{
|
{
|
||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
ret = hif_send(M2M_REQ_GRP_OTA,M2M_OTA_REQ_SWITCH_FIRMWARE,NULL,0,NULL,0,0);
|
ret = hif_send(M2M_REQ_GROUP_OTA,M2M_OTA_REQ_SWITCH_FIRMWARE,NULL,0,NULL,0,0);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
/*!
|
||||||
|
@fn \
|
||||||
|
NMI_API sint8 m2m_ota_get_firmware_version(tstrM2mRev * pstrRev);
|
||||||
|
|
||||||
|
@brief
|
||||||
|
Get the OTA Firmware version.
|
||||||
|
|
||||||
|
@return
|
||||||
|
The function SHALL return 0 for success and a negative value otherwise.
|
||||||
|
*/
|
||||||
|
NMI_API sint8 m2m_ota_get_firmware_version(tstrM2mRev * pstrRev)
|
||||||
|
{
|
||||||
|
sint8 ret = M2M_SUCCESS;
|
||||||
|
ret = hif_chip_wake();
|
||||||
|
if(ret == M2M_SUCCESS)
|
||||||
|
{
|
||||||
|
ret = nm_get_ota_firmware_info(pstrRev);
|
||||||
|
hif_chip_sleep();
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
@ -301,7 +321,7 @@ NMI_API sint8 m2m_ota_test(void)
|
|||||||
}
|
}
|
||||||
printf("page %d\n", (int)page);
|
printf("page %d\n", (int)page);
|
||||||
fread(buffer,page,1,fp);
|
fread(buffer,page,1,fp);
|
||||||
ret = hif_send(M2M_REQ_GRP_OTA,M2M_OTA_REQ_TEST|M2M_REQ_DATA_PKT,NULL,0,(uint8*)&buffer,page,0);
|
ret = hif_send(M2M_REQ_GROUP_OTA,M2M_OTA_REQ_TEST|M2M_REQ_DATA_PKT,NULL,0,(uint8*)&buffer,page,0);
|
||||||
if(ret != M2M_SUCCESS)
|
if(ret != M2M_SUCCESS)
|
||||||
{
|
{
|
||||||
M2M_ERR("\n");
|
M2M_ERR("\n");
|
||||||
|
|||||||
@ -67,6 +67,10 @@ static sint8 get_gpio_idx(uint8 u8GpioNum)
|
|||||||
if(u8GpioNum == M2M_PERIPH_GPIO15) { return 15;
|
if(u8GpioNum == M2M_PERIPH_GPIO15) { return 15;
|
||||||
} else if(u8GpioNum == M2M_PERIPH_GPIO16) { return 16;
|
} else if(u8GpioNum == M2M_PERIPH_GPIO16) { return 16;
|
||||||
} else if(u8GpioNum == M2M_PERIPH_GPIO18) { return 18;
|
} else if(u8GpioNum == M2M_PERIPH_GPIO18) { return 18;
|
||||||
|
} else if(u8GpioNum == M2M_PERIPH_GPIO3) { return 3;
|
||||||
|
} else if(u8GpioNum == M2M_PERIPH_GPIO4) { return 4;
|
||||||
|
} else if(u8GpioNum == M2M_PERIPH_GPIO5) { return 5;
|
||||||
|
} else if(u8GpioNum == M2M_PERIPH_GPIO6) { return 6;
|
||||||
} else {
|
} else {
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,8 +54,8 @@ static uint8* gau8ethRcvBuf=NULL;
|
|||||||
static uint16 gu16ethRcvBufSize ;
|
static uint16 gu16ethRcvBufSize ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CONF_MGMT
|
|
||||||
|
|
||||||
|
//#define CONF_MGMT
|
||||||
#ifdef CONF_MGMT
|
#ifdef CONF_MGMT
|
||||||
static tpfAppMonCb gpfAppMonCb = NULL;
|
static tpfAppMonCb gpfAppMonCb = NULL;
|
||||||
static struct _tstrMgmtCtrl
|
static struct _tstrMgmtCtrl
|
||||||
@ -208,29 +208,45 @@ static void m2m_wifi_cb(uint8 u8OpCode, uint16 u16DataSize, uint32 u32Addr)
|
|||||||
gpfAppWifiCb(M2M_WIFI_RESP_DEFAULT_CONNECT, &strResp);
|
gpfAppWifiCb(M2M_WIFI_RESP_DEFAULT_CONNECT, &strResp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if(u8OpCode == M2M_WIFI_RESP_GET_PRNG)
|
||||||
|
{
|
||||||
|
tstrPrng strPrng;
|
||||||
|
if(hif_receive(u32Addr, (uint8*)&strPrng,sizeof(tstrPrng), 0) == M2M_SUCCESS)
|
||||||
|
{
|
||||||
|
if(hif_receive(u32Addr + sizeof(tstrPrng),strPrng.pu8RngBuff,strPrng.u16PrngSize, 1) == M2M_SUCCESS)
|
||||||
|
{
|
||||||
|
if(gpfAppWifiCb)
|
||||||
|
gpfAppWifiCb(M2M_WIFI_RESP_GET_PRNG,&strPrng);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#ifdef ETH_MODE
|
#ifdef ETH_MODE
|
||||||
else if(u8OpCode == M2M_WIFI_RESP_ETHERNET_RX_PACKET)
|
else if(u8OpCode == M2M_WIFI_RESP_ETHERNET_RX_PACKET)
|
||||||
{
|
{
|
||||||
if(hif_receive(u32Addr, rx_buf ,sizeof(tstrM2mIpRsvdPkt), 0) == M2M_SUCCESS)
|
uint8 u8SetRxDone;
|
||||||
|
tstrM2mIpRsvdPkt strM2mRsvd;
|
||||||
|
if(hif_receive(u32Addr, &strM2mRsvd ,sizeof(tstrM2mIpRsvdPkt), 0) == M2M_SUCCESS)
|
||||||
{
|
{
|
||||||
tstrM2mIpRsvdPkt * pstrM2MIpRxPkt = (tstrM2mIpRsvdPkt*)rx_buf;
|
|
||||||
tstrM2mIpCtrlBuf strM2mIpCtrlBuf;
|
tstrM2mIpCtrlBuf strM2mIpCtrlBuf;
|
||||||
uint16 u16Offset = pstrM2MIpRxPkt->u16PktOffset;
|
uint16 u16Offset = strM2mRsvd.u16PktOffset;
|
||||||
|
strM2mIpCtrlBuf.u16RemainigDataSize = strM2mRsvd.u16PktSz;
|
||||||
strM2mIpCtrlBuf.u16RemainigDataSize = pstrM2MIpRxPkt->u16PktSz;
|
|
||||||
if((gpfAppEthCb) && (gau8ethRcvBuf) && (gu16ethRcvBufSize > 0))
|
if((gpfAppEthCb) && (gau8ethRcvBuf) && (gu16ethRcvBufSize > 0))
|
||||||
{
|
{
|
||||||
while (strM2mIpCtrlBuf.u16RemainigDataSize > 0)
|
do
|
||||||
{
|
{
|
||||||
|
u8SetRxDone = 1;
|
||||||
if(strM2mIpCtrlBuf.u16RemainigDataSize > gu16ethRcvBufSize)
|
if(strM2mIpCtrlBuf.u16RemainigDataSize > gu16ethRcvBufSize)
|
||||||
{
|
{
|
||||||
|
u8SetRxDone = 0;
|
||||||
strM2mIpCtrlBuf.u16DataSize = gu16ethRcvBufSize;
|
strM2mIpCtrlBuf.u16DataSize = gu16ethRcvBufSize;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strM2mIpCtrlBuf.u16DataSize = strM2mIpCtrlBuf.u16RemainigDataSize;
|
strM2mIpCtrlBuf.u16DataSize = strM2mIpCtrlBuf.u16RemainigDataSize;
|
||||||
}
|
}
|
||||||
if(hif_receive(u32Addr+u16Offset, gau8ethRcvBuf, strM2mIpCtrlBuf.u16DataSize, 0) == M2M_SUCCESS)
|
|
||||||
|
if(hif_receive(u32Addr + u16Offset, gau8ethRcvBuf, strM2mIpCtrlBuf.u16DataSize, u8SetRxDone) == M2M_SUCCESS)
|
||||||
{
|
{
|
||||||
strM2mIpCtrlBuf.u16RemainigDataSize -= strM2mIpCtrlBuf.u16DataSize;
|
strM2mIpCtrlBuf.u16RemainigDataSize -= strM2mIpCtrlBuf.u16DataSize;
|
||||||
u16Offset += strM2mIpCtrlBuf.u16DataSize;
|
u16Offset += strM2mIpCtrlBuf.u16DataSize;
|
||||||
@ -240,15 +256,15 @@ static void m2m_wifi_cb(uint8 u8OpCode, uint16 u16DataSize, uint32 u32Addr)
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}while (strM2mIpCtrlBuf.u16RemainigDataSize > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
#endif /* ETH_MODE */
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONF_MGMT
|
#ifdef CONF_MGMT
|
||||||
else if(u8OpCode == M2M_WIFI_RESP_WIFI_RX_PACKET)
|
else if(u8OpCode == M2M_WIFI_RESP_WIFI_RX_PACKET)
|
||||||
{
|
{
|
||||||
|
|
||||||
tstrM2MWifiRxPacketInfo strRxPacketInfo;
|
tstrM2MWifiRxPacketInfo strRxPacketInfo;
|
||||||
if(u16DataSize >= sizeof(tstrM2MWifiRxPacketInfo)) {
|
if(u16DataSize >= sizeof(tstrM2MWifiRxPacketInfo)) {
|
||||||
if(hif_receive(u32Addr, (uint8*)&strRxPacketInfo, sizeof(tstrM2MWifiRxPacketInfo), 0) == M2M_SUCCESS)
|
if(hif_receive(u32Addr, (uint8*)&strRxPacketInfo, sizeof(tstrM2MWifiRxPacketInfo), 0) == M2M_SUCCESS)
|
||||||
@ -261,10 +277,7 @@ static void m2m_wifi_cb(uint8 u8OpCode, uint16 u16DataSize, uint32 u32Addr)
|
|||||||
u16DataSize = gstrMgmtCtrl.u16Sz;
|
u16DataSize = gstrMgmtCtrl.u16Sz;
|
||||||
}
|
}
|
||||||
u32Addr += sizeof(tstrM2MWifiRxPacketInfo) + gstrMgmtCtrl.u16Offset;
|
u32Addr += sizeof(tstrM2MWifiRxPacketInfo) + gstrMgmtCtrl.u16Offset;
|
||||||
if(hif_receive(u32Addr , gstrMgmtCtrl.pu8Buf, u16DataSize, 1) != M2M_SUCCESS)
|
if(hif_receive(u32Addr , gstrMgmtCtrl.pu8Buf, u16DataSize, 1) != M2M_SUCCESS) return;
|
||||||
{
|
|
||||||
u16DataSize = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(gpfAppMonCb)
|
if(gpfAppMonCb)
|
||||||
gpfAppMonCb(&strRxPacketInfo, gstrMgmtCtrl.pu8Buf,u16DataSize);
|
gpfAppMonCb(&strRxPacketInfo, gstrMgmtCtrl.pu8Buf,u16DataSize);
|
||||||
@ -409,7 +422,9 @@ static sint8 m2m_validate_scan_options(tstrM2MScanOption* ptstrM2MScanOption)
|
|||||||
|
|
||||||
sint8 m2m_wifi_init(tstrWifiInitParam * param)
|
sint8 m2m_wifi_init(tstrWifiInitParam * param)
|
||||||
{
|
{
|
||||||
|
tstrM2mRev strtmp;
|
||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
|
uint8 u8WifiMode = M2M_WIFI_MODE_NORMAL;
|
||||||
|
|
||||||
if(param == NULL) {
|
if(param == NULL) {
|
||||||
ret = M2M_ERR_FAIL;
|
ret = M2M_ERR_FAIL;
|
||||||
@ -422,20 +437,31 @@ sint8 m2m_wifi_init(tstrWifiInitParam * param)
|
|||||||
gpfAppEthCb = param->strEthInitParam.pfAppEthCb;
|
gpfAppEthCb = param->strEthInitParam.pfAppEthCb;
|
||||||
gau8ethRcvBuf = param->strEthInitParam.au8ethRcvBuf;
|
gau8ethRcvBuf = param->strEthInitParam.au8ethRcvBuf;
|
||||||
gu16ethRcvBufSize = param->strEthInitParam.u16ethRcvBufSize;
|
gu16ethRcvBufSize = param->strEthInitParam.u16ethRcvBufSize;
|
||||||
#endif
|
u8WifiMode = param->strEthInitParam.u8EthernetEnable;
|
||||||
|
#endif /* ETH_MODE */
|
||||||
|
|
||||||
#ifdef CONF_MGMT
|
#ifdef CONF_MGMT
|
||||||
gpfAppMonCb = param->pfAppMonCb;
|
gpfAppMonCb = param->pfAppMonCb;
|
||||||
#endif
|
#endif
|
||||||
gu8scanInProgress = 0;
|
gu8scanInProgress = 0;
|
||||||
/* Apply device specific initialization. */
|
/* Apply device specific initialization. */
|
||||||
ret = nm_drv_init(NULL);
|
ret = nm_drv_init(&u8WifiMode);
|
||||||
if(ret != M2M_SUCCESS) goto _EXIT0;
|
if(ret != M2M_SUCCESS) goto _EXIT0;
|
||||||
/* Initialize host interface module */
|
/* Initialize host interface module */
|
||||||
ret = hif_init(NULL);
|
ret = hif_init(NULL);
|
||||||
if(ret != M2M_SUCCESS) goto _EXIT1;
|
if(ret != M2M_SUCCESS) goto _EXIT1;
|
||||||
|
|
||||||
hif_register_cb(M2M_REQ_GRP_WIFI,m2m_wifi_cb);
|
hif_register_cb(M2M_REQ_GROUP_WIFI,m2m_wifi_cb);
|
||||||
|
|
||||||
|
ret = nm_get_firmware_info(&strtmp);
|
||||||
|
|
||||||
|
M2M_INFO("Firmware ver : %u.%u.%u\n", strtmp.u8FirmwareMajor, strtmp.u8FirmwareMinor, strtmp.u8FirmwarePatch);
|
||||||
|
M2M_INFO("Min driver ver : %u.%u.%u\n", strtmp.u8DriverMajor, strtmp.u8DriverMinor, strtmp.u8DriverPatch);
|
||||||
|
M2M_INFO("Curr driver ver: %u.%u.%u\n", M2M_DRIVER_VERSION_MAJOR_NO, M2M_DRIVER_VERSION_MINOR_NO, M2M_DRIVER_VERSION_PATCH_NO);
|
||||||
|
if(M2M_ERR_FW_VER_MISMATCH == ret)
|
||||||
|
{
|
||||||
|
M2M_ERR("Mismatch Firmawre Version\n");
|
||||||
|
}
|
||||||
|
|
||||||
goto _EXIT0;
|
goto _EXIT0;
|
||||||
|
|
||||||
@ -463,7 +489,7 @@ sint8 m2m_wifi_handle_events(void * arg)
|
|||||||
|
|
||||||
sint8 m2m_wifi_default_connect(void)
|
sint8 m2m_wifi_default_connect(void)
|
||||||
{
|
{
|
||||||
return hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_DEFAULT_CONNECT, NULL, 0,NULL, 0,0);
|
return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_DEFAULT_CONNECT, NULL, 0,NULL, 0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
sint8 m2m_wifi_connect(char *pcSsid, uint8 u8SsidLen, uint8 u8SecType, void *pvAuthInfo, uint16 u16Ch)
|
sint8 m2m_wifi_connect(char *pcSsid, uint8 u8SsidLen, uint8 u8SecType, void *pvAuthInfo, uint16 u16Ch)
|
||||||
@ -484,6 +510,21 @@ sint8 m2m_wifi_connect_sc(char *pcSsid, uint8 u8SsidLen, uint8 u8SecType, void *
|
|||||||
ret = M2M_ERR_FAIL;
|
ret = M2M_ERR_FAIL;
|
||||||
goto ERR1;
|
goto ERR1;
|
||||||
}
|
}
|
||||||
|
if((u8SecType == M2M_WIFI_SEC_WPA_PSK) && (m2m_strlen(pvAuthInfo) == (M2M_MAX_PSK_LEN-1)))
|
||||||
|
{
|
||||||
|
uint8 i = 0;
|
||||||
|
uint8* pu8Psk = (uint8*)pvAuthInfo;
|
||||||
|
while(i < (M2M_MAX_PSK_LEN-1))
|
||||||
|
{
|
||||||
|
if(pu8Psk[i]<'0' || (pu8Psk[i]>'9' && pu8Psk[i] < 'A')|| (pu8Psk[i]>'F' && pu8Psk[i] < 'a') || pu8Psk[i] > 'f')
|
||||||
|
{
|
||||||
|
M2M_ERR("Invalid Key\n");
|
||||||
|
ret = M2M_ERR_FAIL;
|
||||||
|
goto ERR1;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if((u8SsidLen<=0)||(u8SsidLen>=M2M_MAX_SSID_LEN))
|
if((u8SsidLen<=0)||(u8SsidLen>=M2M_MAX_SSID_LEN))
|
||||||
{
|
{
|
||||||
@ -562,7 +603,7 @@ sint8 m2m_wifi_connect_sc(char *pcSsid, uint8 u8SsidLen, uint8 u8SecType, void *
|
|||||||
goto ERR1;
|
goto ERR1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_CONNECT, (uint8*)&strConnect, sizeof(tstrM2mWifiConnect),NULL, 0,0);
|
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_CONNECT, (uint8*)&strConnect, sizeof(tstrM2mWifiConnect),NULL, 0,0);
|
||||||
|
|
||||||
ERR1:
|
ERR1:
|
||||||
return ret;
|
return ret;
|
||||||
@ -570,13 +611,13 @@ ERR1:
|
|||||||
|
|
||||||
sint8 m2m_wifi_disconnect(void)
|
sint8 m2m_wifi_disconnect(void)
|
||||||
{
|
{
|
||||||
return hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_DISCONNECT, NULL, 0, NULL, 0,0);
|
return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_DISCONNECT, NULL, 0, NULL, 0,0);
|
||||||
}
|
}
|
||||||
sint8 m2m_wifi_set_mac_address(uint8 au8MacAddress[6])
|
sint8 m2m_wifi_set_mac_address(uint8 au8MacAddress[6])
|
||||||
{
|
{
|
||||||
tstrM2mSetMacAddress strTmp;
|
tstrM2mSetMacAddress strTmp;
|
||||||
m2m_memcpy((uint8*) strTmp.au8Mac, (uint8*) au8MacAddress, 6);
|
m2m_memcpy((uint8*) strTmp.au8Mac, (uint8*) au8MacAddress, 6);
|
||||||
return hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SET_MAC_ADDRESS,
|
return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_MAC_ADDRESS,
|
||||||
(uint8*) &strTmp, sizeof(tstrM2mSetMacAddress), NULL, 0,0);
|
(uint8*) &strTmp, sizeof(tstrM2mSetMacAddress), NULL, 0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -588,7 +629,7 @@ sint8 m2m_wifi_set_static_ip(tstrM2MIPConfig * pstrStaticIPConf)
|
|||||||
pstrStaticIPConf->u32StaticIP);
|
pstrStaticIPConf->u32StaticIP);
|
||||||
pstrStaticIPConf->u32SubnetMask = NM_BSP_B_L_32(
|
pstrStaticIPConf->u32SubnetMask = NM_BSP_B_L_32(
|
||||||
pstrStaticIPConf->u32SubnetMask);
|
pstrStaticIPConf->u32SubnetMask);
|
||||||
return hif_send(M2M_REQ_GRP_IP, M2M_IP_REQ_STATIC_IP_CONF,
|
return hif_send(M2M_REQ_GROUP_IP, M2M_IP_REQ_STATIC_IP_CONF,
|
||||||
(uint8*) pstrStaticIPConf, sizeof(tstrM2MIPConfig), NULL, 0,0);
|
(uint8*) pstrStaticIPConf, sizeof(tstrM2MIPConfig), NULL, 0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,19 +659,28 @@ sint8 m2m_wifi_enable_dhcp(uint8 u8DhcpEn )
|
|||||||
|
|
||||||
uint8 u8Req;
|
uint8 u8Req;
|
||||||
u8Req = u8DhcpEn ? M2M_IP_REQ_ENABLE_DHCP : M2M_IP_REQ_DISABLE_DHCP;
|
u8Req = u8DhcpEn ? M2M_IP_REQ_ENABLE_DHCP : M2M_IP_REQ_DISABLE_DHCP;
|
||||||
return hif_send(M2M_REQ_GRP_IP, u8Req, NULL, 0, NULL, 0, 0);
|
return hif_send(M2M_REQ_GROUP_IP, u8Req, NULL, 0, NULL, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sint8 m2m_wifi_set_lsn_int(tstrM2mLsnInt* pstrM2mLsnInt)
|
sint8 m2m_wifi_set_lsn_int(tstrM2mLsnInt* pstrM2mLsnInt)
|
||||||
{
|
{
|
||||||
return hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_LSN_INT, (uint8*)pstrM2mLsnInt, sizeof(tstrM2mLsnInt), NULL, 0, 0);
|
return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_LSN_INT, (uint8*)pstrM2mLsnInt, sizeof(tstrM2mLsnInt), NULL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
sint8 m2m_wifi_set_cust_InfoElement(uint8* pau8M2mCustInfoElement)
|
sint8 m2m_wifi_set_cust_InfoElement(uint8* pau8M2mCustInfoElement)
|
||||||
{
|
{
|
||||||
return hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_CUST_INFO_ELEMENT, (uint8*)pau8M2mCustInfoElement, pau8M2mCustInfoElement[0]+1, NULL, 0, 0);
|
|
||||||
|
sint8 ret = M2M_ERR_FAIL;
|
||||||
|
if(pau8M2mCustInfoElement != NULL)
|
||||||
|
{
|
||||||
|
if((pau8M2mCustInfoElement[0] + 1) < M2M_CUST_IE_LEN_MAX)
|
||||||
|
{
|
||||||
|
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_CUST_INFO_ELEMENT|M2M_REQ_DATA_PKT, (uint8*)pau8M2mCustInfoElement, pau8M2mCustInfoElement[0]+1, NULL, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
sint8 m2m_wifi_set_scan_options(tstrM2MScanOption* ptstrM2MScanOption)
|
sint8 m2m_wifi_set_scan_options(tstrM2MScanOption* ptstrM2MScanOption)
|
||||||
@ -638,7 +688,7 @@ sint8 m2m_wifi_set_scan_options(tstrM2MScanOption* ptstrM2MScanOption)
|
|||||||
sint8 s8Ret = M2M_ERR_FAIL;
|
sint8 s8Ret = M2M_ERR_FAIL;
|
||||||
if(m2m_validate_scan_options (ptstrM2MScanOption) == M2M_SUCCESS)
|
if(m2m_validate_scan_options (ptstrM2MScanOption) == M2M_SUCCESS)
|
||||||
{
|
{
|
||||||
s8Ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SET_SCAN_OPTION, (uint8*)ptstrM2MScanOption, sizeof(tstrM2MScanOption),NULL, 0,0);
|
s8Ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_SCAN_OPTION, (uint8*)ptstrM2MScanOption, sizeof(tstrM2MScanOption),NULL, 0,0);
|
||||||
}
|
}
|
||||||
return s8Ret;
|
return s8Ret;
|
||||||
}
|
}
|
||||||
@ -647,7 +697,7 @@ sint8 m2m_wifi_set_scan_region(uint16 ScanRegion)
|
|||||||
sint8 s8Ret = M2M_ERR_FAIL;
|
sint8 s8Ret = M2M_ERR_FAIL;
|
||||||
tstrM2MScanRegion strScanRegion;
|
tstrM2MScanRegion strScanRegion;
|
||||||
strScanRegion.u16ScanRegion = ScanRegion;
|
strScanRegion.u16ScanRegion = ScanRegion;
|
||||||
s8Ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SET_SCAN_REGION, (uint8*)&strScanRegion, sizeof(tstrM2MScanRegion),NULL, 0,0);
|
s8Ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_SCAN_REGION, (uint8*)&strScanRegion, sizeof(tstrM2MScanRegion),NULL, 0,0);
|
||||||
return s8Ret;
|
return s8Ret;
|
||||||
}
|
}
|
||||||
sint8 m2m_wifi_request_scan(uint8 ch)
|
sint8 m2m_wifi_request_scan(uint8 ch)
|
||||||
@ -660,7 +710,7 @@ sint8 m2m_wifi_request_scan(uint8 ch)
|
|||||||
{
|
{
|
||||||
tstrM2MScan strtmp;
|
tstrM2MScan strtmp;
|
||||||
strtmp.u8ChNum = ch;
|
strtmp.u8ChNum = ch;
|
||||||
s8Ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SCAN, (uint8*)&strtmp, sizeof(tstrM2MScan),NULL, 0,0);
|
s8Ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SCAN, (uint8*)&strtmp, sizeof(tstrM2MScan),NULL, 0,0);
|
||||||
if(s8Ret == M2M_SUCCESS)
|
if(s8Ret == M2M_SUCCESS)
|
||||||
{
|
{
|
||||||
gu8scanInProgress = 1;
|
gu8scanInProgress = 1;
|
||||||
@ -688,12 +738,12 @@ sint8 m2m_wifi_wps(uint8 u8TriggerType,const char *pcPinNumber)
|
|||||||
/*If WPS is using PIN METHOD*/
|
/*If WPS is using PIN METHOD*/
|
||||||
if (u8TriggerType == WPS_PIN_TRIGGER)
|
if (u8TriggerType == WPS_PIN_TRIGGER)
|
||||||
m2m_memcpy ((uint8*)strtmp.acPinNumber,(uint8*) pcPinNumber,8);
|
m2m_memcpy ((uint8*)strtmp.acPinNumber,(uint8*) pcPinNumber,8);
|
||||||
return hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_WPS, (uint8*)&strtmp,sizeof(tstrM2MWPSConnect), NULL, 0,0);
|
return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_WPS, (uint8*)&strtmp,sizeof(tstrM2MWPSConnect), NULL, 0,0);
|
||||||
}
|
}
|
||||||
sint8 m2m_wifi_wps_disable(void)
|
sint8 m2m_wifi_wps_disable(void)
|
||||||
{
|
{
|
||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_DISABLE_WPS, NULL,0, NULL, 0, 0);
|
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_DISABLE_WPS, NULL,0, NULL, 0, 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
@ -714,7 +764,7 @@ sint8 m2m_wifi_req_client_ctrl(uint8 u8Cmd)
|
|||||||
#ifdef _PS_SERVER_
|
#ifdef _PS_SERVER_
|
||||||
tstrM2Mservercmd strCmd;
|
tstrM2Mservercmd strCmd;
|
||||||
strCmd.u8cmd = u8Cmd;
|
strCmd.u8cmd = u8Cmd;
|
||||||
ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_CLIENT_CTRL, (uint8*)&strCmd, sizeof(tstrM2Mservercmd), NULL, 0, 0);
|
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_CLIENT_CTRL, (uint8*)&strCmd, sizeof(tstrM2Mservercmd), NULL, 0, 0);
|
||||||
#else
|
#else
|
||||||
M2M_ERR("_PS_SERVER_ is not defined\n");
|
M2M_ERR("_PS_SERVER_ is not defined\n");
|
||||||
#endif
|
#endif
|
||||||
@ -736,7 +786,7 @@ sint8 m2m_wifi_req_server_init(uint8 ch)
|
|||||||
#ifdef _PS_SERVER_
|
#ifdef _PS_SERVER_
|
||||||
tstrM2mServerInit strServer;
|
tstrM2mServerInit strServer;
|
||||||
strServer.u8Channel = ch;
|
strServer.u8Channel = ch;
|
||||||
ret = hif_send(M2M_REQ_GRP_WIFI,M2M_WIFI_REQ_SERVER_INIT, (uint8*)&strServer, sizeof(tstrM2mServerInit), NULL, 0, 0);
|
ret = hif_send(M2M_REQ_GROUP_WIFI,M2M_WIFI_REQ_SERVER_INIT, (uint8*)&strServer, sizeof(tstrM2mServerInit), NULL, 0, 0);
|
||||||
#else
|
#else
|
||||||
M2M_ERR("_PS_SERVER_ is not defined\n");
|
M2M_ERR("_PS_SERVER_ is not defined\n");
|
||||||
#endif
|
#endif
|
||||||
@ -749,7 +799,7 @@ sint8 m2m_wifi_p2p(uint8 u8Channel)
|
|||||||
{
|
{
|
||||||
tstrM2MP2PConnect strtmp;
|
tstrM2MP2PConnect strtmp;
|
||||||
strtmp.u8ListenChannel = u8Channel;
|
strtmp.u8ListenChannel = u8Channel;
|
||||||
ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_ENABLE_P2P, (uint8*)&strtmp, sizeof(tstrM2MP2PConnect), NULL, 0,0);
|
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_ENABLE_P2P, (uint8*)&strtmp, sizeof(tstrM2MP2PConnect), NULL, 0,0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -761,7 +811,7 @@ sint8 m2m_wifi_p2p(uint8 u8Channel)
|
|||||||
sint8 m2m_wifi_p2p_disconnect(void)
|
sint8 m2m_wifi_p2p_disconnect(void)
|
||||||
{
|
{
|
||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_DISABLE_P2P, NULL, 0, NULL, 0, 0);
|
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_DISABLE_P2P, NULL, 0, NULL, 0, 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
sint8 m2m_wifi_enable_ap(CONST tstrM2MAPConfig* pstrM2MAPConfig)
|
sint8 m2m_wifi_enable_ap(CONST tstrM2MAPConfig* pstrM2MAPConfig)
|
||||||
@ -769,14 +819,14 @@ sint8 m2m_wifi_enable_ap(CONST tstrM2MAPConfig* pstrM2MAPConfig)
|
|||||||
sint8 ret = M2M_ERR_FAIL;
|
sint8 ret = M2M_ERR_FAIL;
|
||||||
if(M2M_SUCCESS == m2m_validate_ap_parameters(pstrM2MAPConfig))
|
if(M2M_SUCCESS == m2m_validate_ap_parameters(pstrM2MAPConfig))
|
||||||
{
|
{
|
||||||
ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_ENABLE_AP, (uint8 *)pstrM2MAPConfig, sizeof(tstrM2MAPConfig), NULL, 0, 0);
|
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_ENABLE_AP, (uint8 *)pstrM2MAPConfig, sizeof(tstrM2MAPConfig), NULL, 0, 0);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
sint8 m2m_wifi_disable_ap(void)
|
sint8 m2m_wifi_disable_ap(void)
|
||||||
{
|
{
|
||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_DISABLE_AP, NULL, 0, NULL, 0, 0);
|
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_DISABLE_AP, NULL, 0, NULL, 0, 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
@ -789,7 +839,7 @@ sint8 m2m_wifi_disable_ap(void)
|
|||||||
sint8 m2m_wifi_req_curr_rssi(void)
|
sint8 m2m_wifi_req_curr_rssi(void)
|
||||||
{
|
{
|
||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_CURRENT_RSSI, NULL, 0, NULL,0, 0);
|
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_CURRENT_RSSI, NULL, 0, NULL,0, 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
sint8 m2m_wifi_send_ethernet_pkt(uint8* pu8Packet,uint16 u16PacketSize)
|
sint8 m2m_wifi_send_ethernet_pkt(uint8* pu8Packet,uint16 u16PacketSize)
|
||||||
@ -801,7 +851,7 @@ sint8 m2m_wifi_send_ethernet_pkt(uint8* pu8Packet,uint16 u16PacketSize)
|
|||||||
|
|
||||||
strTxPkt.u16PacketSize = u16PacketSize;
|
strTxPkt.u16PacketSize = u16PacketSize;
|
||||||
strTxPkt.u16HeaderLength = M2M_ETHERNET_HDR_LEN;
|
strTxPkt.u16HeaderLength = M2M_ETHERNET_HDR_LEN;
|
||||||
s8Ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SEND_ETHERNET_PACKET | M2M_REQ_DATA_PKT,
|
s8Ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SEND_ETHERNET_PACKET | M2M_REQ_DATA_PKT,
|
||||||
(uint8*)&strTxPkt, sizeof(tstrM2MWifiTxPacketInfo), pu8Packet, u16PacketSize, M2M_ETHERNET_HDR_OFFSET - M2M_HIF_HDR_OFFSET);
|
(uint8*)&strTxPkt, sizeof(tstrM2MWifiTxPacketInfo), pu8Packet, u16PacketSize, M2M_ETHERNET_HDR_OFFSET - M2M_HIF_HDR_OFFSET);
|
||||||
}
|
}
|
||||||
return s8Ret;
|
return s8Ret;
|
||||||
@ -880,7 +930,7 @@ sint8 m2m_wifi_req_scan_result(uint8 index)
|
|||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
tstrM2mReqScanResult strReqScanRlt;
|
tstrM2mReqScanResult strReqScanRlt;
|
||||||
strReqScanRlt.u8Index = index;
|
strReqScanRlt.u8Index = index;
|
||||||
ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SCAN_RESULT, (uint8*) &strReqScanRlt, sizeof(tstrM2mReqScanResult), NULL, 0, 0);
|
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SCAN_RESULT, (uint8*) &strReqScanRlt, sizeof(tstrM2mReqScanResult), NULL, 0, 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
@ -929,7 +979,7 @@ sint8 m2m_wifi_set_sleep_mode(uint8 PsTyp, uint8 BcastEn)
|
|||||||
tstrM2mPsType strPs;
|
tstrM2mPsType strPs;
|
||||||
strPs.u8PsType = PsTyp;
|
strPs.u8PsType = PsTyp;
|
||||||
strPs.u8BcastEn = BcastEn;
|
strPs.u8BcastEn = BcastEn;
|
||||||
ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SLEEP, (uint8*) &strPs,sizeof(tstrM2mPsType), NULL, 0, 0);
|
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SLEEP, (uint8*) &strPs,sizeof(tstrM2mPsType), NULL, 0, 0);
|
||||||
M2M_INFO("POWER SAVE %d\n",PsTyp);
|
M2M_INFO("POWER SAVE %d\n",PsTyp);
|
||||||
hif_set_sleep_mode(PsTyp);
|
hif_set_sleep_mode(PsTyp);
|
||||||
return ret;
|
return ret;
|
||||||
@ -952,7 +1002,7 @@ sint8 m2m_wifi_request_sleep(uint32 u32SlpReqTime)
|
|||||||
{
|
{
|
||||||
tstrM2mSlpReqTime strPs;
|
tstrM2mSlpReqTime strPs;
|
||||||
strPs.u32SleepTime = u32SlpReqTime;
|
strPs.u32SleepTime = u32SlpReqTime;
|
||||||
ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_DOZE, (uint8*) &strPs,sizeof(tstrM2mSlpReqTime), NULL, 0, 0);
|
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_DOZE, (uint8*) &strPs,sizeof(tstrM2mSlpReqTime), NULL, 0, 0);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -976,9 +1026,20 @@ sint8 m2m_wifi_set_device_name(uint8 *pu8DeviceName, uint8 u8DeviceNameLength)
|
|||||||
//pu8DeviceName[u8DeviceNameLength] = '\0';
|
//pu8DeviceName[u8DeviceNameLength] = '\0';
|
||||||
u8DeviceNameLength ++;
|
u8DeviceNameLength ++;
|
||||||
m2m_memcpy(strDeviceName.au8DeviceName, pu8DeviceName, u8DeviceNameLength);
|
m2m_memcpy(strDeviceName.au8DeviceName, pu8DeviceName, u8DeviceNameLength);
|
||||||
return hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SET_DEVICE_NAME,
|
return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_DEVICE_NAME,
|
||||||
(uint8*)&strDeviceName, sizeof(tstrM2MDeviceNameConfig), NULL, 0,0);
|
(uint8*)&strDeviceName, sizeof(tstrM2MDeviceNameConfig), NULL, 0,0);
|
||||||
}
|
}
|
||||||
|
sint8 m2m_wifi_get_firmware_version(tstrM2mRev *pstrRev)
|
||||||
|
{
|
||||||
|
sint8 ret = M2M_SUCCESS;
|
||||||
|
ret = hif_chip_wake();
|
||||||
|
if(ret == M2M_SUCCESS)
|
||||||
|
{
|
||||||
|
ret = nm_get_firmware_full_info(pstrRev);
|
||||||
|
hif_chip_sleep();
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
#ifdef CONF_MGMT
|
#ifdef CONF_MGMT
|
||||||
sint8 m2m_wifi_enable_monitoring_mode(tstrM2MWifiMonitorModeCtrl *pstrMtrCtrl, uint8 *pu8PayloadBuffer,
|
sint8 m2m_wifi_enable_monitoring_mode(tstrM2MWifiMonitorModeCtrl *pstrMtrCtrl, uint8 *pu8PayloadBuffer,
|
||||||
uint16 u16BufferSize, uint16 u16DataOffset)
|
uint16 u16BufferSize, uint16 u16DataOffset)
|
||||||
@ -989,18 +1050,15 @@ sint8 m2m_wifi_enable_monitoring_mode(tstrM2MWifiMonitorModeCtrl *pstrMtrCtrl, u
|
|||||||
gstrMgmtCtrl.pu8Buf = pu8PayloadBuffer;
|
gstrMgmtCtrl.pu8Buf = pu8PayloadBuffer;
|
||||||
gstrMgmtCtrl.u16Sz = u16BufferSize;
|
gstrMgmtCtrl.u16Sz = u16BufferSize;
|
||||||
gstrMgmtCtrl.u16Offset = u16DataOffset;
|
gstrMgmtCtrl.u16Offset = u16DataOffset;
|
||||||
s8Ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_ENABLE_MONITORING,
|
s8Ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_ENABLE_MONITORING,
|
||||||
(uint8*)pstrMtrCtrl, sizeof(tstrM2MWifiMonitorModeCtrl), NULL, 0,0);
|
(uint8*)pstrMtrCtrl, sizeof(tstrM2MWifiMonitorModeCtrl), NULL, 0,0);
|
||||||
}
|
}
|
||||||
return s8Ret;
|
return s8Ret;
|
||||||
}
|
}
|
||||||
sint8 m2m_wifi_get_firmware_version(tstrM2mRev *M2mRev)
|
|
||||||
{
|
|
||||||
return nm_get_firmware_info(M2mRev);
|
|
||||||
}
|
|
||||||
sint8 m2m_wifi_disable_monitoring_mode(void)
|
sint8 m2m_wifi_disable_monitoring_mode(void)
|
||||||
{
|
{
|
||||||
return hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_DISABLE_MONITORING, NULL, 0, NULL, 0,0);
|
return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_DISABLE_MONITORING, NULL, 0, NULL, 0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
sint8 m2m_wifi_send_wlan_pkt(uint8 *pu8WlanPacket, uint16 u16WlanHeaderLength, uint16 u16WlanPktSize)
|
sint8 m2m_wifi_send_wlan_pkt(uint8 *pu8WlanPacket, uint16 u16WlanHeaderLength, uint16 u16WlanPktSize)
|
||||||
@ -1012,7 +1070,7 @@ sint8 m2m_wifi_send_wlan_pkt(uint8 *pu8WlanPacket, uint16 u16WlanHeaderLength, u
|
|||||||
|
|
||||||
strTxPkt.u16PacketSize = u16WlanPktSize;
|
strTxPkt.u16PacketSize = u16WlanPktSize;
|
||||||
strTxPkt.u16HeaderLength = u16WlanHeaderLength;
|
strTxPkt.u16HeaderLength = u16WlanHeaderLength;
|
||||||
s8Ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SEND_WIFI_PACKET | M2M_REQ_DATA_PKT,
|
s8Ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SEND_WIFI_PACKET | M2M_REQ_DATA_PKT,
|
||||||
(uint8*)&strTxPkt, sizeof(tstrM2MWifiTxPacketInfo), pu8WlanPacket, u16WlanPktSize, sizeof(tstrM2MWifiTxPacketInfo));
|
(uint8*)&strTxPkt, sizeof(tstrM2MWifiTxPacketInfo), pu8WlanPacket, u16WlanPktSize, sizeof(tstrM2MWifiTxPacketInfo));
|
||||||
}
|
}
|
||||||
return s8Ret;
|
return s8Ret;
|
||||||
@ -1040,7 +1098,7 @@ sint8 m2m_wifi_start_provision_mode(tstrM2MAPConfig *pstrAPConfig, char *pcHttpS
|
|||||||
/* Stop Scan if it is ongoing.
|
/* Stop Scan if it is ongoing.
|
||||||
*/
|
*/
|
||||||
gu8scanInProgress = 0;
|
gu8scanInProgress = 0;
|
||||||
s8Ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_START_PROVISION_MODE | M2M_REQ_DATA_PKT,
|
s8Ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_START_PROVISION_MODE | M2M_REQ_DATA_PKT,
|
||||||
(uint8*)&strProvConfig, sizeof(tstrM2MProvisionModeConfig), NULL, 0, 0);
|
(uint8*)&strProvConfig, sizeof(tstrM2MProvisionModeConfig), NULL, 0, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1054,17 +1112,20 @@ ERR1:
|
|||||||
|
|
||||||
sint8 m2m_wifi_stop_provision_mode(void)
|
sint8 m2m_wifi_stop_provision_mode(void)
|
||||||
{
|
{
|
||||||
return hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_STOP_PROVISION_MODE, NULL, 0, NULL, 0, 0);
|
return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_STOP_PROVISION_MODE, NULL, 0, NULL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
sint8 m2m_wifi_get_connection_info(void)
|
sint8 m2m_wifi_get_connection_info(void)
|
||||||
{
|
{
|
||||||
return hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_GET_CONN_INFO, NULL, 0, NULL, 0, 0);
|
return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_GET_CONN_INFO, NULL, 0, NULL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
sint8 m2m_wifi_set_sytem_time(uint32 u32UTCSeconds)
|
sint8 m2m_wifi_set_sytem_time(uint32 u32UTCSeconds)
|
||||||
{
|
{
|
||||||
return hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SET_SYS_TIME, (uint8*)&u32UTCSeconds, sizeof(tstrSystemTime), NULL, 0, 0);
|
/*
|
||||||
|
The firmware accepts timestamps relative to 1900 like NTP Timestamp.
|
||||||
|
*/
|
||||||
|
return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_SYS_TIME, (uint8*)&u32UTCSeconds, sizeof(tstrSystemTime), NULL, 0, 0);
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
* @fn NMI_API sint8 m2m_wifi_get_sytem_time(void);
|
* @fn NMI_API sint8 m2m_wifi_get_sytem_time(void);
|
||||||
@ -1076,7 +1137,7 @@ sint8 m2m_wifi_set_sytem_time(uint32 u32UTCSeconds)
|
|||||||
*/
|
*/
|
||||||
sint8 m2m_wifi_get_sytem_time(void)
|
sint8 m2m_wifi_get_sytem_time(void)
|
||||||
{
|
{
|
||||||
return hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_GET_SYS_TIME, NULL,0, NULL, 0, 0);
|
return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_GET_SYS_TIME, NULL,0, NULL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
sint8 m2m_wifi_enable_sntp(uint8 bEnable)
|
sint8 m2m_wifi_enable_sntp(uint8 bEnable)
|
||||||
@ -1084,7 +1145,7 @@ sint8 m2m_wifi_enable_sntp(uint8 bEnable)
|
|||||||
uint8 u8Req;
|
uint8 u8Req;
|
||||||
|
|
||||||
u8Req = bEnable ? M2M_WIFI_REQ_ENABLE_SNTP_CLIENT : M2M_WIFI_REQ_DISABLE_SNTP_CLIENT;
|
u8Req = bEnable ? M2M_WIFI_REQ_ENABLE_SNTP_CLIENT : M2M_WIFI_REQ_DISABLE_SNTP_CLIENT;
|
||||||
return hif_send(M2M_REQ_GRP_WIFI, u8Req, NULL, 0, NULL, 0, 0);
|
return hif_send(M2M_REQ_GROUP_WIFI, u8Req, NULL, 0, NULL, 0, 0);
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
@fn NMI_API sint8 m2m_wifi_set_power_profile(uint8 u8PwrMode);
|
@fn NMI_API sint8 m2m_wifi_set_power_profile(uint8 u8PwrMode);
|
||||||
@ -1102,7 +1163,7 @@ sint8 m2m_wifi_set_power_profile(uint8 u8PwrMode)
|
|||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
tstrM2mPwrMode strM2mPwrMode;
|
tstrM2mPwrMode strM2mPwrMode;
|
||||||
strM2mPwrMode.u8PwrMode = u8PwrMode;
|
strM2mPwrMode.u8PwrMode = u8PwrMode;
|
||||||
ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SET_POWER_PROFILE, (uint8*)&strM2mPwrMode,sizeof(tstrM2mPwrMode), NULL, 0, 0);
|
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_POWER_PROFILE, (uint8*)&strM2mPwrMode,sizeof(tstrM2mPwrMode), NULL, 0, 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
@ -1120,7 +1181,7 @@ sint8 m2m_wifi_set_tx_power(uint8 u8TxPwrLevel)
|
|||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
tstrM2mTxPwrLevel strM2mTxPwrLevel;
|
tstrM2mTxPwrLevel strM2mTxPwrLevel;
|
||||||
strM2mTxPwrLevel.u8TxPwrLevel = u8TxPwrLevel;
|
strM2mTxPwrLevel.u8TxPwrLevel = u8TxPwrLevel;
|
||||||
ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SET_TX_POWER, (uint8*)&strM2mTxPwrLevel,sizeof(tstrM2mTxPwrLevel), NULL, 0, 0);
|
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_TX_POWER, (uint8*)&strM2mTxPwrLevel,sizeof(tstrM2mTxPwrLevel), NULL, 0, 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1140,7 +1201,7 @@ sint8 m2m_wifi_enable_firmware_logs(uint8 u8Enable)
|
|||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
tstrM2mEnableLogs strM2mEnableLogs;
|
tstrM2mEnableLogs strM2mEnableLogs;
|
||||||
strM2mEnableLogs.u8Enable = u8Enable;
|
strM2mEnableLogs.u8Enable = u8Enable;
|
||||||
ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SET_ENABLE_LOGS, (uint8*)&strM2mEnableLogs,sizeof(tstrM2mEnableLogs), NULL, 0, 0);
|
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_ENABLE_LOGS, (uint8*)&strM2mEnableLogs,sizeof(tstrM2mEnableLogs), NULL, 0, 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1160,10 +1221,34 @@ sint8 m2m_wifi_set_battery_voltage(uint16 u16BattVoltx100)
|
|||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
tstrM2mBatteryVoltage strM2mBattVol = {0};
|
tstrM2mBatteryVoltage strM2mBattVol = {0};
|
||||||
strM2mBattVol.u16BattVolt = u16BattVoltx100;
|
strM2mBattVol.u16BattVolt = u16BattVoltx100;
|
||||||
ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SET_BATTERY_VOLTAGE, (uint8*)&strM2mBattVol,sizeof(tstrM2mBatteryVoltage), NULL, 0, 0);
|
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_BATTERY_VOLTAGE, (uint8*)&strM2mBattVol,sizeof(tstrM2mBatteryVoltage), NULL, 0, 0);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
/*!
|
||||||
|
@fn sint8 m2m_wifi_prng_get_random_bytes(uint8 * pu8PrngBuff,uint16 u16PrngSize)
|
||||||
|
@brief Get random bytes using the PRNG bytes.
|
||||||
|
@param [in] u16PrngSize
|
||||||
|
Size of the required random bytes to be generated.
|
||||||
|
@param [in] pu8PrngBuff
|
||||||
|
Pointer to user allocated buffer.
|
||||||
|
@return The function SHALL return M2M_SUCCESE for success and a negative value otherwise.
|
||||||
|
*/
|
||||||
|
sint8 m2m_wifi_prng_get_random_bytes(uint8 * pu8PrngBuff,uint16 u16PrngSize)
|
||||||
|
{
|
||||||
|
sint8 ret = M2M_ERR_FAIL;
|
||||||
|
tstrPrng strRng = {0};
|
||||||
|
if((u16PrngSize < (M2M_BUFFER_MAX_SIZE - sizeof(tstrPrng)))&&(pu8PrngBuff != NULL))
|
||||||
|
{
|
||||||
|
strRng.u16PrngSize = u16PrngSize;
|
||||||
|
strRng.pu8RngBuff = pu8PrngBuff;
|
||||||
|
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_GET_PRNG|M2M_REQ_DATA_PKT,(uint8 *)&strRng, sizeof(tstrPrng),NULL,0, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
M2M_ERR("PRNG Buffer exceeded maximum size %d or NULL Buffer\n",u16PrngSize);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ETH_MODE
|
#ifdef ETH_MODE
|
||||||
/*!
|
/*!
|
||||||
@fn \
|
@fn \
|
||||||
@ -1190,7 +1275,7 @@ NMI_API sint8 m2m_wifi_enable_mac_mcast(uint8* pu8MulticastMacAddress, uint8 u8A
|
|||||||
strMulticastMac.u8AddRemove = u8AddRemove;
|
strMulticastMac.u8AddRemove = u8AddRemove;
|
||||||
m2m_memcpy(strMulticastMac.au8macaddress,pu8MulticastMacAddress,M2M_MAC_ADDRES_LEN);
|
m2m_memcpy(strMulticastMac.au8macaddress,pu8MulticastMacAddress,M2M_MAC_ADDRES_LEN);
|
||||||
M2M_DBG("mac multicast: %x:%x:%x:%x:%x:%x\r\n",strMulticastMac.au8macaddress[0],strMulticastMac.au8macaddress[1],strMulticastMac.au8macaddress[2],strMulticastMac.au8macaddress[3],strMulticastMac.au8macaddress[4],strMulticastMac.au8macaddress[5]);
|
M2M_DBG("mac multicast: %x:%x:%x:%x:%x:%x\r\n",strMulticastMac.au8macaddress[0],strMulticastMac.au8macaddress[1],strMulticastMac.au8macaddress[2],strMulticastMac.au8macaddress[3],strMulticastMac.au8macaddress[4],strMulticastMac.au8macaddress[5]);
|
||||||
s8ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SET_MAC_MCAST, (uint8 *)&strMulticastMac,sizeof(tstrM2MMulticastMac),NULL,0,0);
|
s8ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_MAC_MCAST, (uint8 *)&strMulticastMac,sizeof(tstrM2MMulticastMac),NULL,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return s8ret;
|
return s8ret;
|
||||||
@ -1227,5 +1312,5 @@ NMI_API sint8 m2m_wifi_set_receive_buffer(void* pvBuffer,uint16 u16BufferLen)
|
|||||||
}
|
}
|
||||||
return s8ret;
|
return s8ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* ETH_MODE */
|
||||||
|
|
||||||
|
|||||||
@ -43,6 +43,7 @@
|
|||||||
#include "driver/include/nmbus.h"
|
#include "driver/include/nmbus.h"
|
||||||
#include "bsp/include/nm_bsp.h"
|
#include "bsp/include/nm_bsp.h"
|
||||||
#include "driver/include/nmasic.h"
|
#include "driver/include/nmasic.h"
|
||||||
|
#include "driver/include/m2m_types.h"
|
||||||
|
|
||||||
#define NMI_GLB_RESET_0 (NMI_PERIPH_REG_BASE + 0x400)
|
#define NMI_GLB_RESET_0 (NMI_PERIPH_REG_BASE + 0x400)
|
||||||
#define NMI_INTR_REG_BASE (NMI_PERIPH_REG_BASE + 0xa00)
|
#define NMI_INTR_REG_BASE (NMI_PERIPH_REG_BASE + 0xa00)
|
||||||
@ -51,7 +52,7 @@
|
|||||||
#define GET_UINT32(X,Y) (X[0+Y] + ((uint32)X[1+Y]<<8) + ((uint32)X[2+Y]<<16) +((uint32)X[3+Y]<<24))
|
#define GET_UINT32(X,Y) (X[0+Y] + ((uint32)X[1+Y]<<8) + ((uint32)X[2+Y]<<16) +((uint32)X[3+Y]<<24))
|
||||||
|
|
||||||
#define TIMEOUT (2000)
|
#define TIMEOUT (2000)
|
||||||
#define M2M_DISABLE_PS 0xD0UL
|
#define M2M_DISABLE_PS (0xd0ul)
|
||||||
|
|
||||||
static uint32 clk_status_reg_adr = 0xf; /* Assume initially it is B0 chip */
|
static uint32 clk_status_reg_adr = 0xf; /* Assume initially it is B0 chip */
|
||||||
|
|
||||||
@ -135,11 +136,22 @@ sint8 nm_clkless_wake(void)
|
|||||||
/* wait 1ms, spi data read */
|
/* wait 1ms, spi data read */
|
||||||
nm_bsp_sleep(1);
|
nm_bsp_sleep(1);
|
||||||
ret = nm_read_reg_with_ret(clk_status_reg_adr, &clk_status_reg);
|
ret = nm_read_reg_with_ret(clk_status_reg_adr, &clk_status_reg);
|
||||||
|
|
||||||
|
/* Aelmeleh 24-08-2015*/
|
||||||
|
/* Check for C3000 rev. D0 value */
|
||||||
|
if( (ret != M2M_SUCCESS) || ((ret == M2M_SUCCESS) && (clk_status_reg == 0)) ) {
|
||||||
|
|
||||||
|
clk_status_reg_adr = 0x13;
|
||||||
|
/* wait 1ms, spi data read */
|
||||||
|
nm_bsp_sleep(1);
|
||||||
|
ret = nm_read_reg_with_ret(clk_status_reg_adr, &clk_status_reg);
|
||||||
|
|
||||||
if(ret != M2M_SUCCESS) {
|
if(ret != M2M_SUCCESS) {
|
||||||
M2M_ERR("Bus error (2). Wake up failed\n");
|
M2M_ERR("Bus error (2). Wake up failed\n");
|
||||||
goto _WAKE_EXIT;
|
goto _WAKE_EXIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// in case of clocks off, wait 2ms, and check it again.
|
// in case of clocks off, wait 2ms, and check it again.
|
||||||
// if still off, wait for another 2ms, for a total wait of 6ms.
|
// if still off, wait for another 2ms, for a total wait of 6ms.
|
||||||
@ -263,7 +275,6 @@ uint32 nmi_get_chipid(void)
|
|||||||
static uint32 chipid = 0;
|
static uint32 chipid = 0;
|
||||||
|
|
||||||
if (chipid == 0) {
|
if (chipid == 0) {
|
||||||
//uint32 revid;
|
|
||||||
uint32 rfrevid;
|
uint32 rfrevid;
|
||||||
|
|
||||||
if((nm_read_reg_with_ret(0x1000, &chipid)) != M2M_SUCCESS) {
|
if((nm_read_reg_with_ret(0x1000, &chipid)) != M2M_SUCCESS) {
|
||||||
@ -290,7 +301,13 @@ uint32 nmi_get_chipid(void)
|
|||||||
} else /* if(rfrevid == 5) */ { /* 1002B2 */
|
} else /* if(rfrevid == 5) */ { /* 1002B2 */
|
||||||
chipid = 0x1002b2;
|
chipid = 0x1002b2;
|
||||||
}
|
}
|
||||||
|
} else if(chipid == 0x1000F0) {
|
||||||
|
if((nm_read_reg_with_ret(0x3B0000, &chipid)) != M2M_SUCCESS) {
|
||||||
|
chipid = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
//#define PROBE_FLASH
|
//#define PROBE_FLASH
|
||||||
#ifdef PROBE_FLASH
|
#ifdef PROBE_FLASH
|
||||||
@ -361,14 +378,21 @@ void nmi_set_sys_clk_src_to_xo(void)
|
|||||||
/* Do PLL update */
|
/* Do PLL update */
|
||||||
nmi_update_pll();
|
nmi_update_pll();
|
||||||
}
|
}
|
||||||
|
static uint8 check_3000_id(void)
|
||||||
|
{
|
||||||
|
return ((nmi_get_chipid() & (0xf00000)) == 0x300000);
|
||||||
|
}
|
||||||
|
|
||||||
sint8 chip_wake(void)
|
sint8 chip_wake(void)
|
||||||
{
|
{
|
||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
|
|
||||||
ret = nm_clkless_wake();
|
ret = nm_clkless_wake();
|
||||||
if(ret != M2M_SUCCESS) return ret;
|
if(ret != M2M_SUCCESS) return ret;
|
||||||
|
if(!check_3000_id())
|
||||||
|
{
|
||||||
enable_rf_blocks();
|
enable_rf_blocks();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -381,6 +405,8 @@ sint8 chip_reset_and_cpu_halt(void)
|
|||||||
if(ret != M2M_SUCCESS) {
|
if(ret != M2M_SUCCESS) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
if(!check_3000_id())
|
||||||
|
{
|
||||||
chip_reset();
|
chip_reset();
|
||||||
ret = nm_read_reg_with_ret(0x1118, ®);
|
ret = nm_read_reg_with_ret(0x1118, ®);
|
||||||
if (M2M_SUCCESS != ret) {
|
if (M2M_SUCCESS != ret) {
|
||||||
@ -395,15 +421,11 @@ sint8 chip_reset_and_cpu_halt(void)
|
|||||||
ret += nm_write_reg(NMI_GLB_RESET_0, reg);
|
ret += nm_write_reg(NMI_GLB_RESET_0, reg);
|
||||||
ret += nm_read_reg_with_ret(NMI_GLB_RESET_0, ®);
|
ret += nm_read_reg_with_ret(NMI_GLB_RESET_0, ®);
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
reg |= (1ul << 10);
|
|
||||||
ret += nm_write_reg(NMI_GLB_RESET_0, reg);
|
|
||||||
ret += nm_read_reg_with_ret(NMI_GLB_RESET_0, ®);
|
|
||||||
#endif
|
|
||||||
nm_write_reg(BOOTROM_REG,0);
|
nm_write_reg(BOOTROM_REG,0);
|
||||||
nm_write_reg(NMI_STATE_REG,0);
|
nm_write_reg(NMI_STATE_REG,0);
|
||||||
nm_write_reg(NMI_REV_REG,0);
|
nm_write_reg(NMI_REV_REG,0);
|
||||||
nm_write_reg(NMI_PIN_MUX_0, 0x11111000);
|
nm_write_reg(NMI_PIN_MUX_0, 0x11111000);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
sint8 chip_reset(void)
|
sint8 chip_reset(void)
|
||||||
@ -424,6 +446,7 @@ sint8 wait_for_bootrom(uint8 arg)
|
|||||||
{
|
{
|
||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
uint32 reg = 0, cnt = 0;
|
uint32 reg = 0, cnt = 0;
|
||||||
|
uint32 u32GpReg1 = 0;
|
||||||
|
|
||||||
reg = 0;
|
reg = 0;
|
||||||
while(1) {
|
while(1) {
|
||||||
@ -454,19 +477,25 @@ sint8 wait_for_bootrom(uint8 arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(2 == arg) {
|
if(M2M_WIFI_MODE_ATE_HIGH == arg) {
|
||||||
nm_write_reg(NMI_REV_REG, M2M_ATE_FW_START_VALUE);
|
nm_write_reg(NMI_REV_REG, M2M_ATE_FW_START_VALUE);
|
||||||
|
nm_write_reg(NMI_STATE_REG, NBIT20);
|
||||||
|
}else if(M2M_WIFI_MODE_ATE_LOW == arg) {
|
||||||
|
nm_write_reg(NMI_REV_REG, M2M_ATE_FW_START_VALUE);
|
||||||
|
nm_write_reg(NMI_STATE_REG, 0);
|
||||||
|
}else if(M2M_WIFI_MODE_ETHERNET == arg){
|
||||||
|
u32GpReg1 = rHAVE_ETHERNET_MODE_BIT;
|
||||||
} else {
|
} else {
|
||||||
/*bypass this step*/
|
/*bypass this step*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if(REV(nmi_get_chipid()) == REV_3A0)
|
if(REV(nmi_get_chipid()) == REV_3A0)
|
||||||
{
|
{
|
||||||
chip_apply_conf(rHAVE_USE_PMU_BIT);
|
chip_apply_conf(u32GpReg1 | rHAVE_USE_PMU_BIT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
chip_apply_conf(0);
|
chip_apply_conf(u32GpReg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
nm_write_reg(BOOTROM_REG,M2M_START_FIRMWARE);
|
nm_write_reg(BOOTROM_REG,M2M_START_FIRMWARE);
|
||||||
@ -483,22 +512,25 @@ sint8 wait_for_firmware_start(uint8 arg)
|
|||||||
{
|
{
|
||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
uint32 reg = 0, cnt = 0;
|
uint32 reg = 0, cnt = 0;
|
||||||
|
uint32 u32Timeout = TIMEOUT;
|
||||||
volatile uint32 regAddress = NMI_STATE_REG;
|
volatile uint32 regAddress = NMI_STATE_REG;
|
||||||
volatile uint32 checkValue = M2M_FINISH_INIT_STATE;
|
volatile uint32 checkValue = M2M_FINISH_INIT_STATE;
|
||||||
|
|
||||||
if(2 == arg) {
|
if((M2M_WIFI_MODE_ATE_HIGH == arg)||(M2M_WIFI_MODE_ATE_LOW == arg)) {
|
||||||
regAddress = NMI_REV_REG;
|
regAddress = NMI_REV_REG;
|
||||||
checkValue = M2M_ATE_FW_IS_UP_VALUE;
|
checkValue = M2M_ATE_FW_IS_UP_VALUE;
|
||||||
} else {
|
} else {
|
||||||
/*bypass this step*/
|
/*bypass this step*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
while (checkValue != reg)
|
while (checkValue != reg)
|
||||||
{
|
{
|
||||||
|
|
||||||
nm_bsp_sleep(2); /* TODO: Why bus error if this delay is not here. */
|
nm_bsp_sleep(2); /* TODO: Why bus error if this delay is not here. */
|
||||||
M2M_DBG("%x %x %x\n",(unsigned int)nm_read_reg(0x108c),(unsigned int)nm_read_reg(0x108c),(unsigned int)nm_read_reg(0x14A0));
|
M2M_DBG("%x %x %x\n",(unsigned int)nm_read_reg(0x108c),(unsigned int)nm_read_reg(0x108c),(unsigned int)nm_read_reg(0x14A0));
|
||||||
reg = nm_read_reg(regAddress);
|
reg = nm_read_reg(regAddress);
|
||||||
if(++cnt > TIMEOUT)
|
if(++cnt >= u32Timeout)
|
||||||
{
|
{
|
||||||
M2M_DBG("Time out for wait firmware Run\n");
|
M2M_DBG("Time out for wait firmware Run\n");
|
||||||
ret = M2M_ERR_INIT;
|
ret = M2M_ERR_INIT;
|
||||||
@ -636,10 +668,15 @@ sint8 nmi_get_otp_mac_address(uint8 *pu8MacAddr, uint8 * pu8IsValid)
|
|||||||
sint8 ret;
|
sint8 ret;
|
||||||
uint32 u32RegValue;
|
uint32 u32RegValue;
|
||||||
uint8 mac[6];
|
uint8 mac[6];
|
||||||
|
tstrGpRegs strgp = {0};
|
||||||
|
|
||||||
ret = nm_read_reg_with_ret(rNMI_GP_REG_0, &u32RegValue);
|
ret = nm_read_reg_with_ret(rNMI_GP_REG_2, &u32RegValue);
|
||||||
if(ret != M2M_SUCCESS) goto _EXIT_ERR;
|
if(ret != M2M_SUCCESS) goto _EXIT_ERR;
|
||||||
|
|
||||||
|
ret = nm_read_block(u32RegValue|0x30000,(uint8*)&strgp,sizeof(tstrGpRegs));
|
||||||
|
if(ret != M2M_SUCCESS) goto _EXIT_ERR;
|
||||||
|
u32RegValue = strgp.u32Mac_efuse_mib;
|
||||||
|
|
||||||
if(!EFUSED_MAC(u32RegValue)) {
|
if(!EFUSED_MAC(u32RegValue)) {
|
||||||
M2M_DBG("Default MAC\n");
|
M2M_DBG("Default MAC\n");
|
||||||
m2m_memset(pu8MacAddr, 0, 6);
|
m2m_memset(pu8MacAddr, 0, 6);
|
||||||
@ -648,7 +685,7 @@ sint8 nmi_get_otp_mac_address(uint8 *pu8MacAddr, uint8 * pu8IsValid)
|
|||||||
|
|
||||||
M2M_DBG("OTP MAC\n");
|
M2M_DBG("OTP MAC\n");
|
||||||
u32RegValue >>=16;
|
u32RegValue >>=16;
|
||||||
nm_read_block(u32RegValue|0x30000, mac, 6);
|
ret = nm_read_block(u32RegValue|0x30000, mac, 6);
|
||||||
m2m_memcpy(pu8MacAddr,mac,6);
|
m2m_memcpy(pu8MacAddr,mac,6);
|
||||||
if(pu8IsValid) *pu8IsValid = 1;
|
if(pu8IsValid) *pu8IsValid = 1;
|
||||||
return ret;
|
return ret;
|
||||||
@ -663,12 +700,17 @@ sint8 nmi_get_mac_address(uint8 *pu8MacAddr)
|
|||||||
sint8 ret;
|
sint8 ret;
|
||||||
uint32 u32RegValue;
|
uint32 u32RegValue;
|
||||||
uint8 mac[6];
|
uint8 mac[6];
|
||||||
|
tstrGpRegs strgp = {0};
|
||||||
|
|
||||||
ret = nm_read_reg_with_ret(rNMI_GP_REG_0, &u32RegValue);
|
ret = nm_read_reg_with_ret(rNMI_GP_REG_2, &u32RegValue);
|
||||||
if(ret != M2M_SUCCESS) goto _EXIT_ERR;
|
if(ret != M2M_SUCCESS) goto _EXIT_ERR;
|
||||||
|
|
||||||
|
ret = nm_read_block(u32RegValue|0x30000,(uint8*)&strgp,sizeof(tstrGpRegs));
|
||||||
|
if(ret != M2M_SUCCESS) goto _EXIT_ERR;
|
||||||
|
u32RegValue = strgp.u32Mac_efuse_mib;
|
||||||
|
|
||||||
u32RegValue &=0x0000ffff;
|
u32RegValue &=0x0000ffff;
|
||||||
nm_read_block(u32RegValue|0x30000, mac, 6);
|
ret = nm_read_block(u32RegValue|0x30000, mac, 6);
|
||||||
m2m_memcpy(pu8MacAddr, mac, 6);
|
m2m_memcpy(pu8MacAddr, mac, 6);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@ -45,6 +45,7 @@
|
|||||||
#include "driver/include/nmdrv.h"
|
#include "driver/include/nmdrv.h"
|
||||||
#include "driver/include/nmasic.h"
|
#include "driver/include/nmasic.h"
|
||||||
#include "driver/include/m2m_types.h"
|
#include "driver/include/m2m_types.h"
|
||||||
|
#include "spi_flash/include/spi_flash.h"
|
||||||
|
|
||||||
#ifdef CONF_WINC_USE_SPI
|
#ifdef CONF_WINC_USE_SPI
|
||||||
#include "driver/include/nmspi.h"
|
#include "driver/include/nmspi.h"
|
||||||
@ -55,9 +56,6 @@
|
|||||||
* @brief Get Firmware version info
|
* @brief Get Firmware version info
|
||||||
* @param [out] M2mRev
|
* @param [out] M2mRev
|
||||||
* pointer holds address of structure "tstrM2mRev" that contains the firmware version parameters
|
* pointer holds address of structure "tstrM2mRev" that contains the firmware version parameters
|
||||||
|
|
||||||
* @author Ahmad.Mohammad.Yahya
|
|
||||||
* @date 27 MARCH 2013
|
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
sint8 nm_get_firmware_info(tstrM2mRev* M2mRev)
|
sint8 nm_get_firmware_info(tstrM2mRev* M2mRev)
|
||||||
@ -67,7 +65,12 @@ sint8 nm_get_firmware_info(tstrM2mRev* M2mRev)
|
|||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
|
|
||||||
ret = nm_read_reg_with_ret(NMI_REV_REG, ®);
|
ret = nm_read_reg_with_ret(NMI_REV_REG, ®);
|
||||||
|
//In case the Firmware running is ATE fw
|
||||||
|
if(M2M_ATE_FW_IS_UP_VALUE == reg)
|
||||||
|
{
|
||||||
|
//Read FW info again from the register specified for ATE
|
||||||
|
ret = nm_read_reg_with_ret(NMI_REV_REG_ATE, ®);
|
||||||
|
}
|
||||||
M2mRev->u8DriverMajor = M2M_GET_DRV_MAJOR(reg);
|
M2mRev->u8DriverMajor = M2M_GET_DRV_MAJOR(reg);
|
||||||
M2mRev->u8DriverMinor = M2M_GET_DRV_MINOR(reg);
|
M2mRev->u8DriverMinor = M2M_GET_DRV_MINOR(reg);
|
||||||
M2mRev->u8DriverPatch = M2M_GET_DRV_PATCH(reg);
|
M2mRev->u8DriverPatch = M2M_GET_DRV_PATCH(reg);
|
||||||
@ -90,7 +93,132 @@ sint8 nm_get_firmware_info(tstrM2mRev* M2mRev)
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @fn nm_get_firmware_info(tstrM2mRev* M2mRev)
|
||||||
|
* @brief Get Firmware version info
|
||||||
|
* @param [out] M2mRev
|
||||||
|
* pointer holds address of structure "tstrM2mRev" that contains the firmware version parameters
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
sint8 nm_get_firmware_full_info(tstrM2mRev* pstrRev)
|
||||||
|
{
|
||||||
|
uint16 curr_drv_ver, min_req_drv_ver,curr_firm_ver;
|
||||||
|
uint32 reg = 0;
|
||||||
|
sint8 ret = M2M_SUCCESS;
|
||||||
|
tstrGpRegs strgp = {0};
|
||||||
|
if (pstrRev != NULL)
|
||||||
|
{
|
||||||
|
m2m_memset((uint8*)pstrRev,0,sizeof(tstrM2mRev));
|
||||||
|
ret = nm_read_reg_with_ret(rNMI_GP_REG_2, ®);
|
||||||
|
if(ret == M2M_SUCCESS)
|
||||||
|
{
|
||||||
|
if(reg != 0)
|
||||||
|
{
|
||||||
|
ret = nm_read_block(reg|0x30000,(uint8*)&strgp,sizeof(tstrGpRegs));
|
||||||
|
if(ret == M2M_SUCCESS)
|
||||||
|
{
|
||||||
|
reg = strgp.u32Firmware_Ota_rev;
|
||||||
|
reg &= 0x0000ffff;
|
||||||
|
if(reg != 0)
|
||||||
|
{
|
||||||
|
ret = nm_read_block(reg|0x30000,(uint8*)pstrRev,sizeof(tstrM2mRev));
|
||||||
|
if(ret == M2M_SUCCESS)
|
||||||
|
{
|
||||||
|
curr_firm_ver = M2M_MAKE_VERSION(pstrRev->u8FirmwareMajor, pstrRev->u8FirmwareMinor,pstrRev->u8FirmwarePatch);
|
||||||
|
curr_drv_ver = M2M_MAKE_VERSION(M2M_DRIVER_VERSION_MAJOR_NO, M2M_DRIVER_VERSION_MINOR_NO, M2M_DRIVER_VERSION_PATCH_NO);
|
||||||
|
min_req_drv_ver = M2M_MAKE_VERSION(pstrRev->u8DriverMajor, pstrRev->u8DriverMinor,pstrRev->u8DriverPatch);
|
||||||
|
if((curr_firm_ver == 0)||(min_req_drv_ver == 0)||(min_req_drv_ver == 0)){
|
||||||
|
ret = M2M_ERR_FAIL;
|
||||||
|
goto EXIT;
|
||||||
|
}
|
||||||
|
if(curr_drv_ver < min_req_drv_ver) {
|
||||||
|
/*The current driver version should be larger or equal
|
||||||
|
than the min driver that the current firmware support */
|
||||||
|
ret = M2M_ERR_FW_VER_MISMATCH;
|
||||||
|
goto EXIT;
|
||||||
|
}
|
||||||
|
if(curr_drv_ver > curr_firm_ver) {
|
||||||
|
/*The current driver should be equal or less than the firmware version*/
|
||||||
|
ret = M2M_ERR_FW_VER_MISMATCH;
|
||||||
|
goto EXIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
ret = M2M_ERR_FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
ret = M2M_ERR_FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EXIT:
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @fn nm_get_ota_firmware_info(tstrM2mRev* pstrRev)
|
||||||
|
* @brief Get Firmware version info
|
||||||
|
* @param [out] M2mRev
|
||||||
|
* pointer holds address of structure "tstrM2mRev" that contains the firmware version parameters
|
||||||
|
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
sint8 nm_get_ota_firmware_info(tstrM2mRev* pstrRev)
|
||||||
|
{
|
||||||
|
uint16 curr_drv_ver, min_req_drv_ver,curr_firm_ver;
|
||||||
|
uint32 reg = 0;
|
||||||
|
sint8 ret;
|
||||||
|
tstrGpRegs strgp = {0};
|
||||||
|
|
||||||
|
if (pstrRev != NULL)
|
||||||
|
{
|
||||||
|
m2m_memset((uint8*)pstrRev,0,sizeof(tstrM2mRev));
|
||||||
|
ret = nm_read_reg_with_ret(rNMI_GP_REG_2, ®);
|
||||||
|
if(ret == M2M_SUCCESS)
|
||||||
|
{
|
||||||
|
if(reg != 0)
|
||||||
|
{
|
||||||
|
ret = nm_read_block(reg|0x30000,(uint8*)&strgp,sizeof(tstrGpRegs));
|
||||||
|
if(ret == M2M_SUCCESS)
|
||||||
|
{
|
||||||
|
reg = strgp.u32Firmware_Ota_rev;
|
||||||
|
reg >>= 16;
|
||||||
|
if(reg != 0)
|
||||||
|
{
|
||||||
|
ret = nm_read_block(reg|0x30000,(uint8*)pstrRev,sizeof(tstrM2mRev));
|
||||||
|
if(ret == M2M_SUCCESS)
|
||||||
|
{
|
||||||
|
curr_firm_ver = M2M_MAKE_VERSION(pstrRev->u8FirmwareMajor, pstrRev->u8FirmwareMinor,pstrRev->u8FirmwarePatch);
|
||||||
|
curr_drv_ver = M2M_MAKE_VERSION(M2M_DRIVER_VERSION_MAJOR_NO, M2M_DRIVER_VERSION_MINOR_NO, M2M_DRIVER_VERSION_PATCH_NO);
|
||||||
|
min_req_drv_ver = M2M_MAKE_VERSION(pstrRev->u8DriverMajor, pstrRev->u8DriverMinor,pstrRev->u8DriverPatch);
|
||||||
|
if((curr_firm_ver == 0)||(min_req_drv_ver == 0)||(min_req_drv_ver == 0)){
|
||||||
|
ret = M2M_ERR_FAIL;
|
||||||
|
goto EXIT;
|
||||||
|
}
|
||||||
|
if(curr_drv_ver < min_req_drv_ver) {
|
||||||
|
/*The current driver version should be larger or equal
|
||||||
|
than the min driver that the current firmware support */
|
||||||
|
ret = M2M_ERR_FW_VER_MISMATCH;
|
||||||
|
}
|
||||||
|
if(curr_drv_ver > curr_firm_ver) {
|
||||||
|
/*The current driver should be equal or less than the firmware version*/
|
||||||
|
ret = M2M_ERR_FW_VER_MISMATCH;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
ret = M2M_ERR_FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
ret = M2M_ERR_FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret = M2M_ERR_INVALID_ARG;
|
||||||
|
}
|
||||||
|
EXIT:
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -114,6 +242,12 @@ sint8 nm_drv_init_download_mode()
|
|||||||
goto ERR1;
|
goto ERR1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
reset the chip and halt the cpu in case of no wait efuse is set.
|
||||||
|
*/
|
||||||
|
chip_reset_and_cpu_halt();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONF_WINC_USE_SPI
|
#ifdef CONF_WINC_USE_SPI
|
||||||
/* Must do this after global reset to set SPI data packet size. */
|
/* Must do this after global reset to set SPI data packet size. */
|
||||||
@ -141,18 +275,16 @@ ERR1:
|
|||||||
*/
|
*/
|
||||||
sint8 nm_drv_init(void * arg)
|
sint8 nm_drv_init(void * arg)
|
||||||
{
|
{
|
||||||
tstrM2mRev strtmp;
|
|
||||||
sint8 ret = M2M_SUCCESS;
|
sint8 ret = M2M_SUCCESS;
|
||||||
uint8 u8Mode = M2M_WIFI_MODE_NORMAL;
|
uint8 u8Mode;
|
||||||
|
|
||||||
if(NULL != arg) {
|
if(NULL != arg) {
|
||||||
if(M2M_WIFI_MODE_CONFIG == *((uint8 *)arg)) {
|
u8Mode = *((uint8 *)arg);
|
||||||
u8Mode = M2M_WIFI_MODE_CONFIG;
|
if((u8Mode < M2M_WIFI_MODE_NORMAL)||(u8Mode >= M2M_WIFI_MODE_MAX)) {
|
||||||
} else {
|
u8Mode = M2M_WIFI_MODE_NORMAL;
|
||||||
/*continue running*/
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*continue running*/
|
u8Mode = M2M_WIFI_MODE_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = nm_bus_iface_init(NULL);
|
ret = nm_bus_iface_init(NULL);
|
||||||
@ -205,7 +337,7 @@ sint8 nm_drv_init(void * arg)
|
|||||||
goto ERR2;
|
goto ERR2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(M2M_WIFI_MODE_CONFIG == u8Mode) {
|
if((M2M_WIFI_MODE_ATE_HIGH == u8Mode)||(M2M_WIFI_MODE_ATE_LOW == u8Mode)) {
|
||||||
goto ERR1;
|
goto ERR1;
|
||||||
} else {
|
} else {
|
||||||
/*continue running*/
|
/*continue running*/
|
||||||
@ -217,18 +349,6 @@ sint8 nm_drv_init(void * arg)
|
|||||||
goto ERR2;
|
goto ERR2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = nm_get_firmware_info(&strtmp);
|
|
||||||
|
|
||||||
M2M_INFO("Firmware ver : %u.%u.%u\n", strtmp.u8FirmwareMajor, strtmp.u8FirmwareMinor, strtmp.u8FirmwarePatch);
|
|
||||||
M2M_INFO("Min driver ver : %u.%u.%u\n", strtmp.u8DriverMajor, strtmp.u8DriverMinor, strtmp.u8DriverPatch);
|
|
||||||
M2M_INFO("Curr driver ver: %u.%u.%u\n", M2M_DRIVER_VERSION_MAJOR_NO, M2M_DRIVER_VERSION_MINOR_NO, M2M_DRIVER_VERSION_PATCH_NO);
|
|
||||||
|
|
||||||
if(strtmp.u8FirmwareMajor != M2M_DRIVER_VERSION_MAJOR_NO
|
|
||||||
|| strtmp.u8FirmwareMinor != M2M_DRIVER_VERSION_MINOR_NO)
|
|
||||||
{
|
|
||||||
ret = M2M_ERR_FW_VER_MISMATCH;
|
|
||||||
M2M_ERR("Firmware version mismatch!\n");
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
ERR2:
|
ERR2:
|
||||||
nm_bus_iface_deinit();
|
nm_bus_iface_deinit();
|
||||||
@ -253,6 +373,13 @@ sint8 nm_drv_deinit(void * arg)
|
|||||||
goto ERR1;
|
goto ERR1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Disable SPI flash to save power when the chip is off */
|
||||||
|
ret = spi_flash_enable(0);
|
||||||
|
if (M2M_SUCCESS != ret) {
|
||||||
|
M2M_ERR("[nmi stop]: SPI flash disable fail\n");
|
||||||
|
goto ERR1;
|
||||||
|
}
|
||||||
|
|
||||||
ret = nm_bus_iface_deinit();
|
ret = nm_bus_iface_deinit();
|
||||||
if (M2M_SUCCESS != ret) {
|
if (M2M_SUCCESS != ret) {
|
||||||
M2M_ERR("[nmi stop]: fail init bus\n");
|
M2M_ERR("[nmi stop]: fail init bus\n");
|
||||||
|
|||||||
@ -84,17 +84,12 @@
|
|||||||
#define N_RESET -1
|
#define N_RESET -1
|
||||||
#define N_RETRY -2
|
#define N_RETRY -2
|
||||||
|
|
||||||
|
|
||||||
#define DATA_PKT_SZ_256 256
|
#define DATA_PKT_SZ_256 256
|
||||||
#define DATA_PKT_SZ_512 512
|
#define DATA_PKT_SZ_512 512
|
||||||
#define DATA_PKT_SZ_1K 1024
|
#define DATA_PKT_SZ_1K 1024
|
||||||
#define DATA_PKT_SZ_4K (4 * 1024)
|
#define DATA_PKT_SZ_4K (4 * 1024)
|
||||||
#define DATA_PKT_SZ_8K (8 * 1024)
|
#define DATA_PKT_SZ_8K (8 * 1024)
|
||||||
#ifdef SAMG55
|
|
||||||
#define DATA_PKT_SZ DATA_PKT_SZ_1K
|
|
||||||
#else
|
|
||||||
#define DATA_PKT_SZ DATA_PKT_SZ_8K
|
#define DATA_PKT_SZ DATA_PKT_SZ_8K
|
||||||
#endif
|
|
||||||
|
|
||||||
static uint8 gu8Crc_off = 0;
|
static uint8 gu8Crc_off = 0;
|
||||||
|
|
||||||
@ -176,25 +171,6 @@ static uint8 crc7(uint8 crc, const uint8 *buffer, uint32 len)
|
|||||||
|
|
||||||
********************************************/
|
********************************************/
|
||||||
|
|
||||||
#define CMD_DMA_WRITE 0xc1
|
|
||||||
#define CMD_DMA_READ 0xc2
|
|
||||||
#define CMD_INTERNAL_WRITE 0xc3
|
|
||||||
#define CMD_INTERNAL_READ 0xc4
|
|
||||||
#define CMD_TERMINATE 0xc5
|
|
||||||
#define CMD_REPEAT 0xc6
|
|
||||||
#define CMD_DMA_EXT_WRITE 0xc7
|
|
||||||
#define CMD_DMA_EXT_READ 0xc8
|
|
||||||
#define CMD_SINGLE_WRITE 0xc9
|
|
||||||
#define CMD_SINGLE_READ 0xca
|
|
||||||
#define CMD_RESET 0xcf
|
|
||||||
|
|
||||||
#define DATA_PKT_SZ_256 256
|
|
||||||
#define DATA_PKT_SZ_512 512
|
|
||||||
#define DATA_PKT_SZ_1K 1024
|
|
||||||
#define DATA_PKT_SZ_4K (4 * 1024)
|
|
||||||
#define DATA_PKT_SZ_8K (8 * 1024)
|
|
||||||
#define DATA_PKT_SZ DATA_PKT_SZ_8K
|
|
||||||
|
|
||||||
static sint8 spi_cmd(uint8 cmd, uint32 adr, uint32 u32data, uint32 sz,uint8 clockless)
|
static sint8 spi_cmd(uint8 cmd, uint32 adr, uint32 u32data, uint32 sz,uint8 clockless)
|
||||||
{
|
{
|
||||||
uint8 bc[9];
|
uint8 bc[9];
|
||||||
|
|||||||
@ -47,6 +47,7 @@ INCLUDES
|
|||||||
#include "socket/include/socket.h"
|
#include "socket/include/socket.h"
|
||||||
#include "driver/include/m2m_hif.h"
|
#include "driver/include/m2m_hif.h"
|
||||||
#include "socket/include/socket_internal.h"
|
#include "socket/include/socket_internal.h"
|
||||||
|
#include "driver/include/m2m_types.h"
|
||||||
|
|
||||||
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
||||||
MACROS
|
MACROS
|
||||||
@ -66,11 +67,15 @@ MACROS
|
|||||||
#define SSL_TX_PACKET_OFFSET (TCP_TX_PACKET_OFFSET + TLS_RECORD_HEADER_LENGTH)
|
#define SSL_TX_PACKET_OFFSET (TCP_TX_PACKET_OFFSET + TLS_RECORD_HEADER_LENGTH)
|
||||||
|
|
||||||
#define SOCKET_REQUEST(reqID, reqArgs, reqSize, reqPayload, reqPayloadSize, reqPayloadOffset) \
|
#define SOCKET_REQUEST(reqID, reqArgs, reqSize, reqPayload, reqPayloadSize, reqPayloadOffset) \
|
||||||
hif_send(M2M_REQ_GRP_IP, reqID, reqArgs, reqSize, reqPayload, reqPayloadSize, reqPayloadOffset)
|
hif_send(M2M_REQ_GROUP_IP, reqID, reqArgs, reqSize, reqPayload, reqPayloadSize, reqPayloadOffset)
|
||||||
|
|
||||||
|
|
||||||
#define SSL_FLAGS_ACTIVE 0x01
|
#define SSL_FLAGS_ACTIVE NBIT0
|
||||||
#define SSL_FLAGS_BYPASS_X509 0x02
|
#define SSL_FLAGS_BYPASS_X509 NBIT1
|
||||||
|
#define SSL_FLAGS_2_RESERVD NBIT2
|
||||||
|
#define SSL_FLAGS_3_RESERVD NBIT3
|
||||||
|
#define SSL_FLAGS_CACHE_SESSION NBIT4
|
||||||
|
#define SSL_FLAGS_NO_TX_COPY NBIT5
|
||||||
|
|
||||||
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
||||||
PRIVATE DATA TYPES
|
PRIVATE DATA TYPES
|
||||||
@ -93,10 +98,11 @@ typedef struct{
|
|||||||
typedef struct{
|
typedef struct{
|
||||||
uint8 *pu8UserBuffer;
|
uint8 *pu8UserBuffer;
|
||||||
uint16 u16UserBufferSize;
|
uint16 u16UserBufferSize;
|
||||||
|
uint16 u16SessionID;
|
||||||
|
uint16 u16DataOffset;
|
||||||
uint8 bIsUsed;
|
uint8 bIsUsed;
|
||||||
uint8 u8SSLFlags;
|
uint8 u8SSLFlags;
|
||||||
uint8 bIsRecvPending;
|
uint8 bIsRecvPending;
|
||||||
uint16 u16SessionID;
|
|
||||||
}tstrSocket;
|
}tstrSocket;
|
||||||
|
|
||||||
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
|
||||||
@ -113,6 +119,7 @@ volatile tpfAppSocketCb gpfAppSocketCb;
|
|||||||
volatile tpfAppResolveCb gpfAppResolveCb;
|
volatile tpfAppResolveCb gpfAppResolveCb;
|
||||||
volatile uint8 gbSocketInit = 0;
|
volatile uint8 gbSocketInit = 0;
|
||||||
volatile tpfPingCb gfpPingCb;
|
volatile tpfPingCb gfpPingCb;
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
Function
|
Function
|
||||||
Socket_ReadSocketData
|
Socket_ReadSocketData
|
||||||
@ -255,6 +262,10 @@ static void m2m_ip_cb(uint8 u8OpCode, uint16 u16BufferSize,uint32 u32Address)
|
|||||||
{
|
{
|
||||||
strConnMsg.sock = strConnectReply.sock;
|
strConnMsg.sock = strConnectReply.sock;
|
||||||
strConnMsg.s8Error = strConnectReply.s8Error;
|
strConnMsg.s8Error = strConnectReply.s8Error;
|
||||||
|
if(strConnectReply.s8Error == SOCK_ERR_NO_ERROR)
|
||||||
|
{
|
||||||
|
gastrSockets[strConnectReply.sock].u16DataOffset = strConnectReply.u16AppDataOffset - M2M_HIF_HDR_OFFSET;
|
||||||
|
}
|
||||||
if(gpfAppSocketCb)
|
if(gpfAppSocketCb)
|
||||||
gpfAppSocketCb(strConnectReply.sock,SOCKET_MSG_CONNECT, &strConnMsg);
|
gpfAppSocketCb(strConnectReply.sock,SOCKET_MSG_CONNECT, &strConnMsg);
|
||||||
}
|
}
|
||||||
@ -400,12 +411,11 @@ void socketInit(void)
|
|||||||
if(gbSocketInit==0)
|
if(gbSocketInit==0)
|
||||||
{
|
{
|
||||||
m2m_memset((uint8*)gastrSockets, 0, MAX_SOCKET * sizeof(tstrSocket));
|
m2m_memset((uint8*)gastrSockets, 0, MAX_SOCKET * sizeof(tstrSocket));
|
||||||
hif_register_cb(M2M_REQ_GRP_IP,m2m_ip_cb);
|
hif_register_cb(M2M_REQ_GROUP_IP,m2m_ip_cb);
|
||||||
gbSocketInit=1;
|
gbSocketInit=1;
|
||||||
gu16SessionID = 0;
|
gu16SessionID = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
Function
|
Function
|
||||||
socketDeinit
|
socketDeinit
|
||||||
@ -427,13 +437,11 @@ Date
|
|||||||
void socketDeinit(void)
|
void socketDeinit(void)
|
||||||
{
|
{
|
||||||
m2m_memset((uint8*)gastrSockets, 0, MAX_SOCKET * sizeof(tstrSocket));
|
m2m_memset((uint8*)gastrSockets, 0, MAX_SOCKET * sizeof(tstrSocket));
|
||||||
hif_register_cb(M2M_REQ_GRP_IP, NULL);
|
hif_register_cb(M2M_REQ_GROUP_IP, NULL);
|
||||||
gpfAppSocketCb = NULL;
|
gpfAppSocketCb = NULL;
|
||||||
gpfAppResolveCb = NULL;
|
gpfAppResolveCb = NULL;
|
||||||
gbSocketInit = 0;
|
gbSocketInit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
Function
|
Function
|
||||||
registerSocketCallback
|
registerSocketCallback
|
||||||
@ -482,6 +490,7 @@ SOCKET WINC1500_EXPORT(socket)(uint16 u16Domain, uint8 u8Type, uint8 u8Flags)
|
|||||||
{
|
{
|
||||||
SOCKET sock = -1;
|
SOCKET sock = -1;
|
||||||
uint8 u8Count,u8SocketCount = MAX_SOCKET;
|
uint8 u8Count,u8SocketCount = MAX_SOCKET;
|
||||||
|
volatile tstrSocket *pstrSock;
|
||||||
|
|
||||||
/* The only supported family is the AF_INET for UDP and TCP transport layer protocols. */
|
/* The only supported family is the AF_INET for UDP and TCP transport layer protocols. */
|
||||||
if(u16Domain == AF_INET)
|
if(u16Domain == AF_INET)
|
||||||
@ -502,9 +511,12 @@ SOCKET WINC1500_EXPORT(socket)(uint16 u16Domain, uint8 u8Type, uint8 u8Flags)
|
|||||||
|
|
||||||
for(;u8Count < u8SocketCount; u8Count ++)
|
for(;u8Count < u8SocketCount; u8Count ++)
|
||||||
{
|
{
|
||||||
if(gastrSockets[u8Count].bIsUsed == 0)
|
pstrSock = &gastrSockets[u8Count];
|
||||||
|
if(pstrSock->bIsUsed == 0)
|
||||||
{
|
{
|
||||||
gastrSockets[u8Count].bIsUsed = 1;
|
m2m_memset((uint8*)pstrSock, 0, sizeof(tstrSocket));
|
||||||
|
|
||||||
|
pstrSock->bIsUsed = 1;
|
||||||
|
|
||||||
/* The session ID is used to distinguish different socket connections
|
/* The session ID is used to distinguish different socket connections
|
||||||
by comparing the assigned session ID to the one reported by the firmware*/
|
by comparing the assigned session ID to the one reported by the firmware*/
|
||||||
@ -512,7 +524,7 @@ SOCKET WINC1500_EXPORT(socket)(uint16 u16Domain, uint8 u8Type, uint8 u8Flags)
|
|||||||
if(gu16SessionID == 0)
|
if(gu16SessionID == 0)
|
||||||
++gu16SessionID;
|
++gu16SessionID;
|
||||||
|
|
||||||
gastrSockets[u8Count].u16SessionID = gu16SessionID;
|
pstrSock->u16SessionID = gu16SessionID;
|
||||||
M2M_DBG("1 Socket %d session ID = %d\r\n",u8Count, gu16SessionID );
|
M2M_DBG("1 Socket %d session ID = %d\r\n",u8Count, gu16SessionID );
|
||||||
sock = (SOCKET)u8Count;
|
sock = (SOCKET)u8Count;
|
||||||
|
|
||||||
@ -520,7 +532,7 @@ SOCKET WINC1500_EXPORT(socket)(uint16 u16Domain, uint8 u8Type, uint8 u8Flags)
|
|||||||
{
|
{
|
||||||
tstrSSLSocketCreateCmd strSSLCreate;
|
tstrSSLSocketCreateCmd strSSLCreate;
|
||||||
strSSLCreate.sslSock = sock;
|
strSSLCreate.sslSock = sock;
|
||||||
gastrSockets[u8Count].u8SSLFlags = SSL_FLAGS_ACTIVE;
|
pstrSock->u8SSLFlags = SSL_FLAGS_ACTIVE | SSL_FLAGS_NO_TX_COPY;
|
||||||
SOCKET_REQUEST(SOCKET_CMD_SSL_CREATE, (uint8*)&strSSLCreate, sizeof(tstrSSLSocketCreateCmd), 0, 0, 0);
|
SOCKET_REQUEST(SOCKET_CMD_SSL_CREATE, (uint8*)&strSSLCreate, sizeof(tstrSSLSocketCreateCmd), 0, 0, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -558,7 +570,6 @@ sint8 WINC1500_EXPORT(bind)(SOCKET sock, struct sockaddr *pstrAddr, uint8 u8Addr
|
|||||||
/* Build the bind request. */
|
/* Build the bind request. */
|
||||||
strBind.sock = sock;
|
strBind.sock = sock;
|
||||||
m2m_memcpy((uint8 *)&strBind.strAddr, (uint8 *)pstrAddr, sizeof(tstrSockAddr));
|
m2m_memcpy((uint8 *)&strBind.strAddr, (uint8 *)pstrAddr, sizeof(tstrSockAddr));
|
||||||
//strBind.strAddr = *((tstrSockAddr*)pstrAddr);
|
|
||||||
|
|
||||||
strBind.strAddr.u16Family = strBind.strAddr.u16Family;
|
strBind.strAddr.u16Family = strBind.strAddr.u16Family;
|
||||||
strBind.strAddr.u16Port = strBind.strAddr.u16Port;
|
strBind.strAddr.u16Port = strBind.strAddr.u16Port;
|
||||||
@ -675,9 +686,6 @@ sint8 WINC1500_EXPORT(connect)(SOCKET sock, struct sockaddr *pstrAddr, uint8 u8A
|
|||||||
strConnect.sock = sock;
|
strConnect.sock = sock;
|
||||||
m2m_memcpy((uint8 *)&strConnect.strAddr, (uint8 *)pstrAddr, sizeof(tstrSockAddr));
|
m2m_memcpy((uint8 *)&strConnect.strAddr, (uint8 *)pstrAddr, sizeof(tstrSockAddr));
|
||||||
|
|
||||||
strConnect.strAddr.u16Family = strConnect.strAddr.u16Family;
|
|
||||||
strConnect.strAddr.u16Port = strConnect.strAddr.u16Port;
|
|
||||||
strConnect.strAddr.u32IPAddr = strConnect.strAddr.u32IPAddr;
|
|
||||||
strConnect.u16SessionID = gastrSockets[sock].u16SessionID;
|
strConnect.u16SessionID = gastrSockets[sock].u16SessionID;
|
||||||
s8Ret = SOCKET_REQUEST(u8Cmd, (uint8*)&strConnect,sizeof(tstrConnectCmd), NULL, 0, 0);
|
s8Ret = SOCKET_REQUEST(u8Cmd, (uint8*)&strConnect,sizeof(tstrConnectCmd), NULL, 0, 0);
|
||||||
if(s8Ret != SOCK_ERR_NO_ERROR)
|
if(s8Ret != SOCK_ERR_NO_ERROR)
|
||||||
@ -728,7 +736,7 @@ sint16 WINC1500_EXPORT(send)(SOCKET sock, void *pvSendBuffer, uint16 u16SendLeng
|
|||||||
if(gastrSockets[sock].u8SSLFlags & SSL_FLAGS_ACTIVE)
|
if(gastrSockets[sock].u8SSLFlags & SSL_FLAGS_ACTIVE)
|
||||||
{
|
{
|
||||||
u8Cmd = SOCKET_CMD_SSL_SEND;
|
u8Cmd = SOCKET_CMD_SSL_SEND;
|
||||||
u16DataOffset = SSL_TX_PACKET_OFFSET;
|
u16DataOffset = gastrSockets[sock].u16DataOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
s16Ret = SOCKET_REQUEST(u8Cmd|M2M_REQ_DATA_PKT, (uint8*)&strSend, sizeof(tstrSendCmd), pvSendBuffer, u16SendLength, u16DataOffset);
|
s16Ret = SOCKET_REQUEST(u8Cmd|M2M_REQ_DATA_PKT, (uint8*)&strSend, sizeof(tstrSendCmd), pvSendBuffer, u16SendLength, u16DataOffset);
|
||||||
@ -1060,7 +1068,7 @@ Version
|
|||||||
Date
|
Date
|
||||||
9 September 2014
|
9 September 2014
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
sint8 sslSetSockOpt(SOCKET sock, uint8 u8Opt, const void *pvOptVal, uint16 u16OptLen)
|
static sint8 sslSetSockOpt(SOCKET sock, uint8 u8Opt, const void *pvOptVal, uint16 u16OptLen)
|
||||||
{
|
{
|
||||||
sint8 s8Ret = SOCK_ERR_INVALID_ARG;
|
sint8 s8Ret = SOCK_ERR_INVALID_ARG;
|
||||||
if(sock < TCP_SOCK_MAX)
|
if(sock < TCP_SOCK_MAX)
|
||||||
@ -1080,6 +1088,19 @@ sint8 sslSetSockOpt(SOCKET sock, uint8 u8Opt, const void *pvOptVal, uint16 u16O
|
|||||||
}
|
}
|
||||||
s8Ret = SOCK_ERR_NO_ERROR;
|
s8Ret = SOCK_ERR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
else if(u8Opt == SO_SSL_ENABLE_SESSION_CACHING)
|
||||||
|
{
|
||||||
|
int optVal = *((int*)pvOptVal);
|
||||||
|
if(optVal)
|
||||||
|
{
|
||||||
|
gastrSockets[sock].u8SSLFlags |= SSL_FLAGS_CACHE_SESSION;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gastrSockets[sock].u8SSLFlags &= ~SSL_FLAGS_CACHE_SESSION;
|
||||||
|
}
|
||||||
|
s8Ret = SOCK_ERR_NO_ERROR;
|
||||||
|
}
|
||||||
else if(u8Opt == SO_SSL_SNI)
|
else if(u8Opt == SO_SSL_SNI)
|
||||||
{
|
{
|
||||||
if(u16OptLen < HOSTNAME_MAX_SIZE)
|
if(u16OptLen < HOSTNAME_MAX_SIZE)
|
||||||
@ -1222,3 +1243,33 @@ sint8 m2m_ping_req(uint32 u32DstIP, uint8 u8TTL, tpfPingCb fpPingCb)
|
|||||||
}
|
}
|
||||||
return s8Ret;
|
return s8Ret;
|
||||||
}
|
}
|
||||||
|
/*********************************************************************
|
||||||
|
Function
|
||||||
|
sslSetActiveCipherSuites
|
||||||
|
|
||||||
|
Description
|
||||||
|
Send Ping request.
|
||||||
|
|
||||||
|
Return
|
||||||
|
|
||||||
|
Author
|
||||||
|
Ahmed Ezzat
|
||||||
|
|
||||||
|
Version
|
||||||
|
1.0
|
||||||
|
|
||||||
|
Date
|
||||||
|
4 June 2015
|
||||||
|
*********************************************************************/
|
||||||
|
sint8 sslSetActiveCipherSuites(uint32 u32SslCsBMP)
|
||||||
|
{
|
||||||
|
sint8 s8Ret = SOCK_ERR_INVALID_ARG;
|
||||||
|
if(u32SslCsBMP != 0)
|
||||||
|
{
|
||||||
|
tstrSslSetActiveCsList strCsList;
|
||||||
|
|
||||||
|
strCsList.u32CsBMP = u32SslCsBMP;
|
||||||
|
s8Ret = SOCKET_REQUEST(SOCKET_CMD_SSL_SET_CS_LIST, (uint8*)&strCsList, sizeof(tstrSslSetActiveCsList), NULL, 0, 0);
|
||||||
|
}
|
||||||
|
return s8Ret;
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user