Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: NNN50_CE_Test_UDP NNN50_linux_firmware NNN50_SoftAP_HelloWorld NNN50_BLEWIFISensor ... more
nm_common.h
00001 /** 00002 * 00003 * \file 00004 * 00005 * \brief WINC Driver Common API Declarations. 00006 * 00007 * Copyright (c) 2016-2017 Atmel Corporation. All rights reserved. 00008 * 00009 * \asf_license_start 00010 * 00011 * \page License 00012 * 00013 * Redistribution and use in source and binary forms, with or without 00014 * modification, are permitted provided that the following conditions are met: 00015 * 00016 * 1. Redistributions of source code must retain the above copyright notice, 00017 * this list of conditions and the following disclaimer. 00018 * 00019 * 2. Redistributions in binary form must reproduce the above copyright notice, 00020 * this list of conditions and the following disclaimer in the documentation 00021 * and/or other materials provided with the distribution. 00022 * 00023 * 3. The name of Atmel may not be used to endorse or promote products derived 00024 * from this software without specific prior written permission. 00025 * 00026 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 00027 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00028 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00029 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 00030 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00031 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00032 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00033 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00034 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00035 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00036 * POSSIBILITY OF SUCH DAMAGE. 00037 * 00038 * \asf_license_stop 00039 * 00040 */ 00041 00042 #ifndef _NM_COMMON_H_ 00043 #define _NM_COMMON_H_ 00044 00045 #include "bsp/include/nm_bsp.h" 00046 #include "common/include/nm_debug.h" 00047 00048 /**@defgroup CommonDefines CommonDefines 00049 * @ingroup WlanDefines 00050 */ 00051 /**@{*/ 00052 #define M2M_TIME_OUT_DELAY 10000 00053 00054 /*states*/ 00055 #define M2M_SUCCESS ((sint8)0) 00056 #define M2M_ERR_SEND ((sint8)-1) 00057 #define M2M_ERR_RCV ((sint8)-2) 00058 #define M2M_ERR_MEM_ALLOC ((sint8)-3) 00059 #define M2M_ERR_TIME_OUT ((sint8)-4) 00060 #define M2M_ERR_INIT ((sint8)-5) 00061 #define M2M_ERR_BUS_FAIL ((sint8)-6) 00062 #define M2M_NOT_YET ((sint8)-7) 00063 #define M2M_ERR_FIRMWARE ((sint8)-8) 00064 #define M2M_SPI_FAIL ((sint8)-9) 00065 #define M2M_ERR_FIRMWARE_bURN ((sint8)-10) 00066 #define M2M_ACK ((sint8)-11) 00067 #define M2M_ERR_FAIL ((sint8)-12) 00068 #define M2M_ERR_FW_VER_MISMATCH ((sint8)-13) 00069 #define M2M_ERR_SCAN_IN_PROGRESS ((sint8)-14) 00070 #define M2M_ERR_INVALID_ARG ((sint8)-15) 00071 #define M2M_ERR_INVALID ((sint8)-16) 00072 00073 /*i2c MAASTER ERR*/ 00074 #define I2C_ERR_LARGE_ADDRESS 0xE1UL /*the address exceed the max addressing mode in i2c flash*/ 00075 #define I2C_ERR_TX_ABRT 0xE2UL /*NO ACK from slave*/ 00076 #define I2C_ERR_OVER_SIZE 0xE3UL /**/ 00077 #define ERR_PREFIX_NMIS 0xE4UL /*wrong first four byte in flash NMIS*/ 00078 #define ERR_FIRMEWARE_EXCEED_SIZE 0xE5UL /*Total size of firmware exceed the max size 256k*/ 00079 /**/ 00080 #define PROGRAM_START 0x26961735UL 00081 #define BOOT_SUCCESS 0x10add09eUL 00082 #define BOOT_START 0x12345678UL 00083 00084 00085 #define NBIT31 (0x80000000) 00086 #define NBIT30 (0x40000000) 00087 #define NBIT29 (0x20000000) 00088 #define NBIT28 (0x10000000) 00089 #define NBIT27 (0x08000000) 00090 #define NBIT26 (0x04000000) 00091 #define NBIT25 (0x02000000) 00092 #define NBIT24 (0x01000000) 00093 #define NBIT23 (0x00800000) 00094 #define NBIT22 (0x00400000) 00095 #define NBIT21 (0x00200000) 00096 #define NBIT20 (0x00100000) 00097 #define NBIT19 (0x00080000) 00098 #define NBIT18 (0x00040000) 00099 #define NBIT17 (0x00020000) 00100 #define NBIT16 (0x00010000) 00101 #define NBIT15 (0x00008000) 00102 #define NBIT14 (0x00004000) 00103 #define NBIT13 (0x00002000) 00104 #define NBIT12 (0x00001000) 00105 #define NBIT11 (0x00000800) 00106 #define NBIT10 (0x00000400) 00107 #define NBIT9 (0x00000200) 00108 #define NBIT8 (0x00000100) 00109 #define NBIT7 (0x00000080) 00110 #define NBIT6 (0x00000040) 00111 #define NBIT5 (0x00000020) 00112 #define NBIT4 (0x00000010) 00113 #define NBIT3 (0x00000008) 00114 #define NBIT2 (0x00000004) 00115 #define NBIT1 (0x00000002) 00116 #define NBIT0 (0x00000001) 00117 00118 #define M2M_MAX(A,B) ((A) > (B) ? (A) : (B)) 00119 #define M2M_SEL(x,m1,m2,m3) ((x>1)?((x>2)?(m3):(m2)):(m1)) 00120 #define WORD_ALIGN(val) (((val) & 0x03) ? ((val) + 4 - ((val) & 0x03)) : (val)) 00121 00122 00123 00124 #define DATA_PKT_OFFSET 4 00125 00126 #ifndef BIG_ENDIAN 00127 #define BYTE_0(word) ((uint8)(((word) >> 0 ) & 0x000000FFUL)) 00128 #define BYTE_1(word) ((uint8)(((word) >> 8 ) & 0x000000FFUL)) 00129 #define BYTE_2(word) ((uint8)(((word) >> 16) & 0x000000FFUL)) 00130 #define BYTE_3(word) ((uint8)(((word) >> 24) & 0x000000FFUL)) 00131 #else 00132 #define BYTE_0(word) ((uint8)(((word) >> 24) & 0x000000FFUL)) 00133 #define BYTE_1(word) ((uint8)(((word) >> 16) & 0x000000FFUL)) 00134 #define BYTE_2(word) ((uint8)(((word) >> 8 ) & 0x000000FFUL)) 00135 #define BYTE_3(word) ((uint8)(((word) >> 0 ) & 0x000000FFUL)) 00136 #endif 00137 00138 /**@}*/ 00139 #ifdef __cplusplus 00140 extern "C" { 00141 #endif 00142 NMI_API void m2m_memcpy(uint8* pDst,uint8* pSrc,uint32 sz); 00143 NMI_API void m2m_memset(uint8* pBuf,uint8 val,uint32 sz); 00144 NMI_API uint16 m2m_strlen(uint8 * pcStr); 00145 NMI_API sint8 m2m_memcmp(uint8 *pu8Buff1,uint8 *pu8Buff2 ,uint32 u32Size); 00146 NMI_API uint8 m2m_strncmp(uint8 *pcS1, uint8 *pcS2, uint16 u16Len); 00147 NMI_API uint8 * m2m_strstr(uint8 *pcIn, uint8 *pcStr); 00148 NMI_API uint8 m2m_checksum(uint8* buf, int sz); 00149 00150 #ifdef __cplusplus 00151 } 00152 #endif 00153 #endif /*_NM_COMMON_H_*/ 00154
Generated on Wed Jul 13 2022 16:32:37 by
1.7.2