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
m2m_wifi.c
00001 /** 00002 * 00003 * \file 00004 * 00005 * \brief This module contains M2M Wi-Fi APIs implementation. 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 #include "driver/include/m2m_wifi.h" 00043 #include "driver/source/m2m_hif.h" 00044 #include "driver/source/nmasic.h" 00045 00046 static volatile uint8 gu8ChNum; 00047 static volatile uint8 gu8scanInProgress = 0; 00048 static tpfAppWifiCb gpfAppWifiCb = NULL; 00049 00050 00051 #ifdef ETH_MODE 00052 static tpfAppEthCb gpfAppEthCb = NULL; 00053 static uint8* gau8ethRcvBuf=NULL; 00054 static uint16 gu16ethRcvBufSize ; 00055 #endif 00056 00057 00058 //#define CONF_MGMT 00059 #ifdef CONF_MGMT 00060 static tpfAppMonCb gpfAppMonCb = NULL; 00061 static struct _tstrMgmtCtrl 00062 { 00063 uint8* pu8Buf; 00064 uint16 u16Offset; 00065 uint16 u16Sz; 00066 } 00067 gstrMgmtCtrl = {NULL, 0 , 0}; 00068 #endif 00069 /** 00070 * @fn m2m_wifi_cb(uint8 u8OpCode, uint16 u16DataSize, uint32 u32Addr, uint8 grp) 00071 * @brief WiFi call back function 00072 * @param [in] u8OpCode 00073 * HIF Opcode type. 00074 * @param [in] u16DataSize 00075 * HIF data length. 00076 * @param [in] u32Addr 00077 * HIF address. 00078 * @param [in] grp 00079 * HIF group type. 00080 * @author 00081 * @date 00082 * @version 1.0 00083 */ 00084 static void m2m_wifi_cb(uint8 u8OpCode, uint16 u16DataSize, uint32 u32Addr) 00085 { 00086 uint8 rx_buf[8]; 00087 if (u8OpCode == M2M_WIFI_RESP_CON_STATE_CHANGED ) 00088 { 00089 tstrM2mWifiStateChanged strState; 00090 if (hif_receive(u32Addr, (uint8*) &strState,sizeof(tstrM2mWifiStateChanged), 0) == M2M_SUCCESS) 00091 { 00092 if (gpfAppWifiCb) 00093 gpfAppWifiCb(M2M_WIFI_RESP_CON_STATE_CHANGED , &strState); 00094 } 00095 } 00096 else if (u8OpCode == M2M_WIFI_RESP_GET_SYS_TIME ) 00097 { 00098 tstrSystemTime strSysTime; 00099 if (hif_receive(u32Addr, (uint8*) &strSysTime,sizeof(tstrSystemTime), 0) == M2M_SUCCESS) 00100 { 00101 if (gpfAppWifiCb) 00102 gpfAppWifiCb(M2M_WIFI_RESP_GET_SYS_TIME , &strSysTime); 00103 } 00104 } 00105 else if(u8OpCode == M2M_WIFI_RESP_CONN_INFO ) 00106 { 00107 tstrM2MConnInfo strConnInfo; 00108 if(hif_receive(u32Addr, (uint8*)&strConnInfo, sizeof(tstrM2MConnInfo), 1) == M2M_SUCCESS) 00109 { 00110 if(gpfAppWifiCb) 00111 gpfAppWifiCb(M2M_WIFI_RESP_CONN_INFO , &strConnInfo); 00112 } 00113 } 00114 else if (u8OpCode == M2M_WIFI_RESP_MEMORY_RECOVER ) 00115 { 00116 #if 0 00117 if (hif_receive(u32Addr, rx_buf, 4, 1) == M2M_SUCCESS) 00118 { 00119 tstrM2mWifiStateChanged strState; 00120 m2m_memcpy((uint8*) &strState, rx_buf,sizeof(tstrM2mWifiStateChanged)); 00121 if (app_wifi_recover_cb) 00122 app_wifi_recover_cb(strState.u8CurrState); 00123 } 00124 #endif 00125 } 00126 else if (u8OpCode == M2M_WIFI_REQ_DHCP_CONF ) 00127 { 00128 tstrM2MIPConfig strIpConfig; 00129 if (hif_receive(u32Addr, (uint8 *)&strIpConfig, sizeof(tstrM2MIPConfig), 0) == M2M_SUCCESS) 00130 { 00131 if (gpfAppWifiCb) 00132 gpfAppWifiCb(M2M_WIFI_REQ_DHCP_CONF , (uint8 *)&strIpConfig); 00133 } 00134 } 00135 else if (u8OpCode == M2M_WIFI_REQ_WPS ) 00136 { 00137 tstrM2MWPSInfo strWps; 00138 m2m_memset((uint8*)&strWps,0,sizeof(tstrM2MWPSInfo)); 00139 if(hif_receive(u32Addr, (uint8*)&strWps, sizeof(tstrM2MWPSInfo), 0) == M2M_SUCCESS) 00140 { 00141 if (gpfAppWifiCb) 00142 gpfAppWifiCb(M2M_WIFI_REQ_WPS , &strWps); 00143 } 00144 } 00145 else if (u8OpCode == M2M_WIFI_RESP_IP_CONFLICT ) 00146 { 00147 uint32 u32ConflictedIP; 00148 if(hif_receive(u32Addr, (uint8 *)&u32ConflictedIP, sizeof(u32ConflictedIP), 0) == M2M_SUCCESS) 00149 { 00150 M2M_INFO("Conflicted IP \" %u.%u.%u.%u \" \n", 00151 BYTE_0(u32ConflictedIP),BYTE_1(u32ConflictedIP),BYTE_2(u32ConflictedIP),BYTE_3(u32ConflictedIP)); 00152 if (gpfAppWifiCb) 00153 gpfAppWifiCb(M2M_WIFI_RESP_IP_CONFLICT , NULL); 00154 00155 } 00156 } 00157 else if (u8OpCode == M2M_WIFI_RESP_SCAN_DONE ) 00158 { 00159 tstrM2mScanDone strState; 00160 gu8scanInProgress = 0; 00161 if(hif_receive(u32Addr, (uint8*)&strState, sizeof(tstrM2mScanDone), 0) == M2M_SUCCESS) 00162 { 00163 gu8ChNum = strState.u8NumofCh; 00164 if (gpfAppWifiCb) 00165 gpfAppWifiCb(M2M_WIFI_RESP_SCAN_DONE , &strState); 00166 } 00167 } 00168 else if (u8OpCode == M2M_WIFI_RESP_SCAN_RESULT ) 00169 { 00170 tstrM2mWifiscanResult strScanResult; 00171 if(hif_receive(u32Addr, (uint8*)&strScanResult, sizeof(tstrM2mWifiscanResult), 0) == M2M_SUCCESS) 00172 { 00173 if (gpfAppWifiCb) 00174 gpfAppWifiCb(M2M_WIFI_RESP_SCAN_RESULT , &strScanResult); 00175 } 00176 } 00177 else if (u8OpCode == M2M_WIFI_RESP_CURRENT_RSSI ) 00178 { 00179 if (hif_receive(u32Addr, rx_buf, 4, 0) == M2M_SUCCESS) 00180 { 00181 if (gpfAppWifiCb) 00182 gpfAppWifiCb(M2M_WIFI_RESP_CURRENT_RSSI , rx_buf); 00183 } 00184 } 00185 else if (u8OpCode == M2M_WIFI_RESP_CLIENT_INFO) 00186 { 00187 if (hif_receive(u32Addr, rx_buf, 4, 0) == M2M_SUCCESS) 00188 { 00189 if (gpfAppWifiCb) 00190 gpfAppWifiCb(M2M_WIFI_RESP_CLIENT_INFO, rx_buf); 00191 } 00192 } 00193 else if(u8OpCode == M2M_WIFI_RESP_PROVISION_INFO ) 00194 { 00195 tstrM2MProvisionInfo strProvInfo; 00196 if(hif_receive(u32Addr, (uint8*)&strProvInfo, sizeof(tstrM2MProvisionInfo), 1) == M2M_SUCCESS) 00197 { 00198 if(gpfAppWifiCb) 00199 gpfAppWifiCb(M2M_WIFI_RESP_PROVISION_INFO , &strProvInfo); 00200 } 00201 } 00202 else if(u8OpCode == M2M_WIFI_RESP_DEFAULT_CONNECT ) 00203 { 00204 tstrM2MDefaultConnResp strResp; 00205 if(hif_receive(u32Addr, (uint8*)&strResp, sizeof(tstrM2MDefaultConnResp), 1) == M2M_SUCCESS) 00206 { 00207 if(gpfAppWifiCb) 00208 gpfAppWifiCb(M2M_WIFI_RESP_DEFAULT_CONNECT , &strResp); 00209 } 00210 } 00211 00212 else if(u8OpCode == M2M_WIFI_RESP_GET_PRNG ) 00213 { 00214 tstrPrng strPrng; 00215 if(hif_receive(u32Addr, (uint8*)&strPrng,sizeof(tstrPrng), 0) == M2M_SUCCESS) 00216 { 00217 if(hif_receive(u32Addr + sizeof(tstrPrng),strPrng.pu8RngBuff,strPrng.u16PrngSize, 1) == M2M_SUCCESS) 00218 { 00219 if(gpfAppWifiCb) 00220 gpfAppWifiCb(M2M_WIFI_RESP_GET_PRNG ,&strPrng); 00221 } 00222 } 00223 } 00224 #ifdef ETH_MODE 00225 else if(u8OpCode == M2M_WIFI_RESP_ETHERNET_RX_PACKET ) 00226 { 00227 uint8 u8SetRxDone; 00228 tstrM2mIpRsvdPkt strM2mRsvd; 00229 if(hif_receive(u32Addr, &strM2mRsvd ,sizeof(tstrM2mIpRsvdPkt), 0) == M2M_SUCCESS) 00230 { 00231 tstrM2mIpCtrlBuf strM2mIpCtrlBuf; 00232 uint16 u16Offset = strM2mRsvd.u16PktOffset; 00233 strM2mIpCtrlBuf.u16RemainigDataSize = strM2mRsvd.u16PktSz; 00234 if((gpfAppEthCb) && (gau8ethRcvBuf) && (gu16ethRcvBufSize > 0)) 00235 { 00236 do 00237 { 00238 u8SetRxDone = 1; 00239 if(strM2mIpCtrlBuf.u16RemainigDataSize > gu16ethRcvBufSize) 00240 { 00241 u8SetRxDone = 0; 00242 strM2mIpCtrlBuf.u16DataSize = gu16ethRcvBufSize; 00243 } 00244 else 00245 { 00246 strM2mIpCtrlBuf.u16DataSize = strM2mIpCtrlBuf.u16RemainigDataSize ; 00247 } 00248 00249 if(hif_receive(u32Addr + u16Offset, gau8ethRcvBuf, strM2mIpCtrlBuf.u16DataSize , u8SetRxDone) == M2M_SUCCESS) 00250 { 00251 strM2mIpCtrlBuf.u16RemainigDataSize -= strM2mIpCtrlBuf.u16DataSize ; 00252 u16Offset += strM2mIpCtrlBuf.u16DataSize ; 00253 gpfAppEthCb(M2M_WIFI_RESP_ETHERNET_RX_PACKET , gau8ethRcvBuf, &(strM2mIpCtrlBuf)); 00254 } 00255 else 00256 { 00257 break; 00258 } 00259 }while (strM2mIpCtrlBuf.u16RemainigDataSize > 0); 00260 } 00261 } 00262 } 00263 #endif /* ETH_MODE */ 00264 #ifdef CONF_MGMT 00265 else if(u8OpCode == M2M_WIFI_RESP_WIFI_RX_PACKET ) 00266 { 00267 00268 tstrM2MWifiRxPacketInfo strRxPacketInfo; 00269 if(u16DataSize >= sizeof(tstrM2MWifiRxPacketInfo)) { 00270 if(hif_receive(u32Addr, (uint8*)&strRxPacketInfo, sizeof(tstrM2MWifiRxPacketInfo), 0) == M2M_SUCCESS) 00271 { 00272 u16DataSize -= sizeof(tstrM2MWifiRxPacketInfo); 00273 if(u16DataSize > 0 && gstrMgmtCtrl.pu8Buf != NULL) 00274 { 00275 if(u16DataSize > (gstrMgmtCtrl.u16Sz + gstrMgmtCtrl.u16Offset)) 00276 { 00277 u16DataSize = gstrMgmtCtrl.u16Sz; 00278 } 00279 u32Addr += sizeof(tstrM2MWifiRxPacketInfo) + gstrMgmtCtrl.u16Offset; 00280 if(hif_receive(u32Addr , gstrMgmtCtrl.pu8Buf, u16DataSize, 1) != M2M_SUCCESS) return; 00281 } 00282 if(gpfAppMonCb) 00283 gpfAppMonCb(&strRxPacketInfo, gstrMgmtCtrl.pu8Buf,u16DataSize); 00284 } 00285 } else { 00286 M2M_ERR("Incorrect mon data size %u\n", u16DataSize); 00287 } 00288 } 00289 #endif 00290 else 00291 { 00292 M2M_ERR("REQ Not defined %d\n",u8OpCode); 00293 } 00294 } 00295 00296 sint8 m2m_wifi_download_mode() 00297 { 00298 sint8 ret = M2M_SUCCESS; 00299 /* Apply device specific initialization. */ 00300 ret = nm_drv_init_download_mode (); 00301 if(ret != M2M_SUCCESS) goto _EXIT0; 00302 00303 00304 00305 enable_interrupts (); 00306 00307 _EXIT0: 00308 return ret; 00309 } 00310 00311 static sint8 m2m_validate_ap_parameters(CONST tstrM2MAPConfig* pstrM2MAPConfig) 00312 { 00313 sint8 s8Ret = M2M_SUCCESS; 00314 /* Check for incoming pointer */ 00315 if(pstrM2MAPConfig == NULL) 00316 { 00317 M2M_ERR("INVALID POINTER\n"); 00318 s8Ret = M2M_ERR_FAIL; 00319 goto ERR1; 00320 } 00321 /* Check for SSID */ 00322 if((m2m_strlen((uint8 *)pstrM2MAPConfig->au8SSID) <= 0) || (m2m_strlen((uint8 *)pstrM2MAPConfig->au8SSID) >= M2M_MAX_SSID_LEN)) 00323 { 00324 M2M_ERR("INVALID SSID\n"); 00325 s8Ret = M2M_ERR_FAIL; 00326 goto ERR1; 00327 } 00328 /* Check for Channel */ 00329 if(pstrM2MAPConfig->u8ListenChannel > M2M_WIFI_CH_14 || pstrM2MAPConfig->u8ListenChannel < M2M_WIFI_CH_1) 00330 { 00331 M2M_ERR("INVALID CH\n"); 00332 s8Ret = M2M_ERR_FAIL; 00333 goto ERR1; 00334 } 00335 /* Check for DHCP Server IP address */ 00336 if(!(pstrM2MAPConfig->au8DHCPServerIP[0] || pstrM2MAPConfig->au8DHCPServerIP[1])) 00337 { 00338 if(!(pstrM2MAPConfig->au8DHCPServerIP[2])) 00339 { 00340 M2M_ERR("INVALID DHCP SERVER IP\n"); 00341 s8Ret = M2M_ERR_FAIL; 00342 goto ERR1; 00343 } 00344 } 00345 /* Check for Security */ 00346 if(pstrM2MAPConfig->u8SecType == M2M_WIFI_SEC_OPEN ) 00347 { 00348 goto ERR1; 00349 } 00350 else if(pstrM2MAPConfig->u8SecType == M2M_WIFI_SEC_WEP ) 00351 { 00352 /* Check for WEP Key index */ 00353 if((pstrM2MAPConfig->u8KeyIndx <= 0) || (pstrM2MAPConfig->u8KeyIndx > WEP_KEY_MAX_INDEX)) 00354 { 00355 M2M_ERR("INVALID KEY INDEX\n"); 00356 s8Ret = M2M_ERR_FAIL; 00357 goto ERR1; 00358 } 00359 /* Check for WEP Key size */ 00360 if( (pstrM2MAPConfig->u8KeySz != WEP_40_KEY_STRING_SIZE) && 00361 (pstrM2MAPConfig->u8KeySz != WEP_104_KEY_STRING_SIZE) 00362 ) 00363 { 00364 M2M_ERR("INVALID KEY STRING SIZE\n"); 00365 s8Ret = M2M_ERR_FAIL; 00366 goto ERR1; 00367 } 00368 00369 if((m2m_strlen((uint8 *)pstrM2MAPConfig->au8WepKey) <= 0) || (m2m_strlen((uint8 *)pstrM2MAPConfig->au8WepKey) > WEP_104_KEY_STRING_SIZE)) 00370 { 00371 M2M_ERR("INVALID KEY SIZE\n"); 00372 s8Ret = M2M_ERR_FAIL; 00373 goto ERR1; 00374 } 00375 } 00376 else if(pstrM2MAPConfig->u8SecType == M2M_WIFI_SEC_WPA_PSK ) 00377 { 00378 /* Check for WPA Key size */ 00379 if( ((pstrM2MAPConfig->u8KeySz + 1) < M2M_MIN_PSK_LEN) || ((pstrM2MAPConfig->u8KeySz + 1) > M2M_MAX_PSK_LEN)) 00380 { 00381 M2M_ERR("INVALID WPA KEY SIZE\n"); 00382 s8Ret = M2M_ERR_FAIL; 00383 goto ERR1; 00384 } 00385 } 00386 else 00387 { 00388 M2M_ERR("INVALID AUTHENTICATION MODE\n"); 00389 s8Ret = M2M_ERR_FAIL; 00390 goto ERR1; 00391 } 00392 00393 ERR1: 00394 return s8Ret; 00395 } 00396 static sint8 m2m_validate_scan_options(tstrM2MScanOption* ptstrM2MScanOption) 00397 { 00398 sint8 s8Ret = M2M_SUCCESS; 00399 /* Check for incoming pointer */ 00400 if(ptstrM2MScanOption == NULL) 00401 { 00402 M2M_ERR("INVALID POINTER\n"); 00403 s8Ret = M2M_ERR_FAIL; 00404 goto ERR; 00405 } 00406 /* Check for valid No of slots */ 00407 if(ptstrM2MScanOption->u8NumOfSlot == 0) 00408 { 00409 M2M_ERR("INVALID No of scan slots! %d\n",ptstrM2MScanOption->u8NumOfSlot); 00410 s8Ret = M2M_ERR_FAIL; 00411 goto ERR; 00412 } 00413 /* Check for valid time of slots */ 00414 if(ptstrM2MScanOption->u8SlotTime < 10 || ptstrM2MScanOption->u8SlotTime > 250) 00415 { 00416 M2M_ERR("INVALID scan slot time! %d\n",ptstrM2MScanOption->u8SlotTime); 00417 s8Ret = M2M_ERR_FAIL; 00418 goto ERR; 00419 } 00420 /* Check for valid No of probe requests per slot */ 00421 if((ptstrM2MScanOption->u8ProbesPerSlot == 0)||(ptstrM2MScanOption->u8ProbesPerSlot > M2M_SCAN_DEFAULT_NUM_PROBE)) 00422 { 00423 M2M_ERR("INVALID No of probe requests per scan slot %d\n",ptstrM2MScanOption->u8ProbesPerSlot ); 00424 s8Ret = M2M_ERR_FAIL; 00425 goto ERR; 00426 } 00427 /* Check for valid RSSI threshold */ 00428 if((ptstrM2MScanOption->s8RssiThresh < -99) || (ptstrM2MScanOption->s8RssiThresh >= 0)) 00429 { 00430 M2M_ERR("INVALID RSSI threshold %d \n",ptstrM2MScanOption->s8RssiThresh); 00431 s8Ret = M2M_ERR_FAIL; 00432 } 00433 00434 ERR: 00435 return s8Ret; 00436 } 00437 00438 sint8 m2m_wifi_send_crl(tstrTlsCrlInfo* pCRL) 00439 { 00440 sint8 s8Ret = M2M_ERR_FAIL; 00441 s8Ret = hif_send(M2M_REQ_GROUP_SSL, M2M_SSL_IND_CRL|M2M_REQ_DATA_PKT, NULL, 0, (uint8*)pCRL, sizeof(tstrTlsCrlInfo), 0); 00442 return s8Ret; 00443 } 00444 00445 sint8 m2m_wifi_init(tstrWifiInitParam * param) 00446 { 00447 tstrM2mRev strtmp; 00448 sint8 ret = M2M_SUCCESS; 00449 uint8 u8WifiMode = M2M_WIFI_MODE_NORMAL ; 00450 00451 if(param == NULL) { 00452 ret = M2M_ERR_FAIL; 00453 goto _EXIT0; 00454 } 00455 00456 gpfAppWifiCb = param->pfAppWifiCb ; 00457 00458 #ifdef ETH_MODE 00459 gpfAppEthCb = param->strEthInitParam .pfAppEthCb ; 00460 gau8ethRcvBuf = param->strEthInitParam .au8ethRcvBuf ; 00461 gu16ethRcvBufSize = param->strEthInitParam .u16ethRcvBufSize ; 00462 u8WifiMode = param->strEthInitParam .u8EthernetEnable ; 00463 #endif /* ETH_MODE */ 00464 00465 #ifdef CONF_MGMT 00466 gpfAppMonCb = param->pfAppMonCb ; 00467 #endif 00468 gu8scanInProgress = 0; 00469 /* Apply device specific initialization. */ 00470 ret = nm_drv_init (&u8WifiMode); 00471 if(ret != M2M_SUCCESS) goto _EXIT0; 00472 /* Initialize host interface module */ 00473 ret = hif_init(NULL); 00474 if(ret != M2M_SUCCESS) goto _EXIT1; 00475 00476 hif_register_cb(M2M_REQ_GROUP_WIFI,m2m_wifi_cb); 00477 00478 ret = nm_get_firmware_full_info(&strtmp); 00479 00480 M2M_INFO("Firmware ver : %u.%u.%u Svnrev %u\n", strtmp.u8FirmwareMajor, strtmp.u8FirmwareMinor, strtmp.u8FirmwarePatch,strtmp.u16FirmwareSvnNum); 00481 M2M_INFO("Firmware Build %s Time %s\n",strtmp.BuildDate,strtmp.BuildTime); 00482 M2M_INFO("Firmware Min driver ver : %u.%u.%u\n", strtmp.u8DriverMajor, strtmp.u8DriverMinor, strtmp.u8DriverPatch); 00483 M2M_INFO("Driver ver: %u.%u.%u\n", M2M_RELEASE_VERSION_MAJOR_NO, M2M_RELEASE_VERSION_MINOR_NO, M2M_RELEASE_VERSION_PATCH_NO); 00484 M2M_INFO("Driver built at %s\t%s\n",__DATE__,__TIME__); 00485 if(M2M_ERR_FW_VER_MISMATCH == ret) 00486 { 00487 M2M_ERR("Mismatch Firmawre Version\n"); 00488 } 00489 00490 goto _EXIT0; 00491 00492 _EXIT1: 00493 nm_drv_deinit(NULL); 00494 _EXIT0: 00495 return ret; 00496 } 00497 00498 sint8 m2m_wifi_deinit(void * arg) 00499 { 00500 00501 hif_deinit(NULL); 00502 00503 nm_drv_deinit(NULL); 00504 00505 return M2M_SUCCESS; 00506 } 00507 00508 uint8 locker = 0; 00509 sint8 m2m_wifi_handle_events(void * arg) 00510 { 00511 if(locker == 0) { 00512 locker = 1; 00513 int ret; 00514 ret = hif_handle_isr(); 00515 locker = 0; 00516 return ret; 00517 } 00518 return 0; 00519 } 00520 00521 sint8 m2m_wifi_default_connect(void) 00522 { 00523 return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_DEFAULT_CONNECT , NULL, 0,NULL, 0,0); 00524 } 00525 00526 sint8 m2m_wifi_connect(char *pcSsid, uint8 u8SsidLen, uint8 u8SecType, void *pvAuthInfo, uint16 u16Ch) 00527 { 00528 return m2m_wifi_connect_sc(pcSsid, u8SsidLen, u8SecType, pvAuthInfo, u16Ch,0); 00529 } 00530 sint8 m2m_wifi_connect_sc(char *pcSsid, uint8 u8SsidLen, uint8 u8SecType, void *pvAuthInfo, uint16 u16Ch, uint8 u8NoSaveCred) 00531 { 00532 sint8 ret = M2M_SUCCESS; 00533 tstrM2mWifiConnect strConnect; 00534 tstrM2MWifiSecInfo *pstrAuthInfo; 00535 00536 if(u8SecType != M2M_WIFI_SEC_OPEN ) 00537 { 00538 if(pvAuthInfo == NULL) 00539 { 00540 M2M_ERR("Key is not valid\n"); 00541 ret = M2M_ERR_FAIL; 00542 goto ERR1; 00543 } 00544 if((u8SecType == M2M_WIFI_SEC_WPA_PSK ) && (m2m_strlen(pvAuthInfo) == (M2M_MAX_PSK_LEN-1))) 00545 { 00546 uint8 i = 0; 00547 uint8* pu8Psk = (uint8*)pvAuthInfo; 00548 while(i < (M2M_MAX_PSK_LEN-1)) 00549 { 00550 if(pu8Psk[i]<'0' || (pu8Psk[i]>'9' && pu8Psk[i] < 'A')|| (pu8Psk[i]>'F' && pu8Psk[i] < 'a') || pu8Psk[i] > 'f') 00551 { 00552 M2M_ERR("Invalid Key\n"); 00553 ret = M2M_ERR_FAIL; 00554 goto ERR1; 00555 } 00556 i++; 00557 } 00558 } 00559 } 00560 if((u8SsidLen<=0)||(u8SsidLen>=M2M_MAX_SSID_LEN)) 00561 { 00562 M2M_ERR("SSID LEN INVALID\n"); 00563 ret = M2M_ERR_FAIL; 00564 goto ERR1; 00565 } 00566 00567 if(u16Ch < M2M_WIFI_CH_1|| u16Ch > M2M_WIFI_CH_14) 00568 { 00569 if(u16Ch!=M2M_WIFI_CH_ALL) 00570 { 00571 M2M_ERR("CH INVALID\n"); 00572 ret = M2M_ERR_FAIL; 00573 goto ERR1; 00574 } 00575 } 00576 00577 00578 m2m_memcpy(strConnect.au8SSID , (uint8*)pcSsid, u8SsidLen); 00579 strConnect.au8SSID [u8SsidLen] = 0; 00580 strConnect.u16Ch = NM_BSP_B_L_16(u16Ch); 00581 /* Credentials will be Not be saved if u8NoSaveCred is set */ 00582 strConnect.u8NoSaveCred = u8NoSaveCred ? 1:0; 00583 pstrAuthInfo = &strConnect.strSec ; 00584 pstrAuthInfo->u8SecType = u8SecType; 00585 00586 if(u8SecType == M2M_WIFI_SEC_WEP ) 00587 { 00588 tstrM2mWifiWepParams * pstrWepParams = (tstrM2mWifiWepParams*)pvAuthInfo; 00589 tstrM2mWifiWepParams *pstrWep = &pstrAuthInfo->uniAuth .strWepInfo ; 00590 pstrWep->u8KeyIndx =pstrWepParams->u8KeyIndx -1; 00591 00592 if(pstrWep->u8KeyIndx >= WEP_KEY_MAX_INDEX) 00593 { 00594 M2M_ERR("Invalid Wep key index %d\n", pstrWep->u8KeyIndx ); 00595 ret = M2M_ERR_FAIL; 00596 goto ERR1; 00597 } 00598 pstrWep->u8KeySz = pstrWepParams->u8KeySz -1; 00599 if ((pstrWep->u8KeySz != WEP_40_KEY_STRING_SIZE)&& (pstrWep->u8KeySz != WEP_104_KEY_STRING_SIZE)) 00600 { 00601 M2M_ERR("Invalid Wep key length %d\n", pstrWep->u8KeySz ); 00602 ret = M2M_ERR_FAIL; 00603 goto ERR1; 00604 } 00605 m2m_memcpy((uint8*)pstrWep->au8WepKey ,(uint8*)pstrWepParams->au8WepKey , pstrWepParams->u8KeySz ); 00606 pstrWep->au8WepKey [pstrWepParams->u8KeySz ] = 0; 00607 00608 } 00609 00610 00611 else if(u8SecType == M2M_WIFI_SEC_WPA_PSK ) 00612 { 00613 uint16 u16KeyLen = m2m_strlen((uint8*)pvAuthInfo); 00614 if((u16KeyLen <= 0)||(u16KeyLen >= M2M_MAX_PSK_LEN)) 00615 { 00616 M2M_ERR("Incorrect PSK key length\n"); 00617 ret = M2M_ERR_FAIL; 00618 goto ERR1; 00619 } 00620 m2m_memcpy(pstrAuthInfo->uniAuth .au8PSK , (uint8*)pvAuthInfo, u16KeyLen + 1); 00621 } 00622 else if(u8SecType == M2M_WIFI_SEC_802_1X ) 00623 { 00624 m2m_memcpy((uint8*)&pstrAuthInfo->uniAuth .strCred1x , (uint8*)pvAuthInfo, sizeof(tstr1xAuthCredentials)); 00625 } 00626 else if(u8SecType == M2M_WIFI_SEC_OPEN ) 00627 { 00628 00629 } 00630 else 00631 { 00632 M2M_ERR("undefined sec type\n"); 00633 ret = M2M_ERR_FAIL; 00634 goto ERR1; 00635 } 00636 00637 ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_CONNECT , (uint8*)&strConnect, sizeof(tstrM2mWifiConnect),NULL, 0,0); 00638 00639 ERR1: 00640 return ret; 00641 } 00642 00643 sint8 m2m_wifi_disconnect(void) 00644 { 00645 return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_DISCONNECT , NULL, 0, NULL, 0,0); 00646 } 00647 sint8 m2m_wifi_set_mac_address(uint8 au8MacAddress[6]) 00648 { 00649 tstrM2mSetMacAddress strTmp; 00650 m2m_memcpy((uint8*) strTmp.au8Mac , (uint8*) au8MacAddress, 6); 00651 return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_MAC_ADDRESS , 00652 (uint8*) &strTmp, sizeof(tstrM2mSetMacAddress), NULL, 0,0); 00653 } 00654 00655 sint8 m2m_wifi_set_static_ip(tstrM2MIPConfig * pstrStaticIPConf) 00656 { 00657 pstrStaticIPConf->u32DNS = NM_BSP_B_L_32(pstrStaticIPConf->u32DNS ); 00658 pstrStaticIPConf->u32Gateway = NM_BSP_B_L_32(pstrStaticIPConf->u32Gateway ); 00659 pstrStaticIPConf->u32StaticIP = NM_BSP_B_L_32( 00660 pstrStaticIPConf->u32StaticIP ); 00661 pstrStaticIPConf->u32SubnetMask = NM_BSP_B_L_32( 00662 pstrStaticIPConf->u32SubnetMask ); 00663 return hif_send(M2M_REQ_GROUP_IP, M2M_IP_REQ_STATIC_IP_CONF, 00664 (uint8*) pstrStaticIPConf, sizeof(tstrM2MIPConfig), NULL, 0,0); 00665 } 00666 00667 sint8 m2m_wifi_request_dhcp_client(void) 00668 { 00669 /*legacy API should be removed */ 00670 return 0; 00671 } 00672 sint8 m2m_wifi_request_dhcp_server(uint8* addr) 00673 { 00674 /*legacy API should be removed */ 00675 return 0; 00676 } 00677 /*! 00678 @fn NMI_API sint8 m2m_wifi_set_lsn_int(tstrM2mLsnInt * pstrM2mLsnInt); 00679 @brief Set the Wi-Fi listen interval for power save operation. It is represented in units 00680 of AP Beacon periods. 00681 @param [in] pstrM2mLsnInt 00682 Structure holding the listen interval configurations. 00683 @return The function SHALL return 0 for success and a negative value otherwise. 00684 @sa tstrM2mLsnInt , m2m_wifi_set_sleep_mode 00685 @pre m2m_wifi_set_sleep_mode shall be called first 00686 @warning The Function called once after initialization. 00687 */ 00688 sint8 m2m_wifi_enable_dhcp(uint8 u8DhcpEn ) 00689 { 00690 00691 uint8 u8Req; 00692 u8Req = u8DhcpEn ? M2M_IP_REQ_ENABLE_DHCP : M2M_IP_REQ_DISABLE_DHCP; 00693 return hif_send(M2M_REQ_GROUP_IP, u8Req, NULL, 0, NULL, 0, 0); 00694 00695 00696 } 00697 00698 sint8 m2m_wifi_set_lsn_int(tstrM2mLsnInt* pstrM2mLsnInt) 00699 { 00700 return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_LSN_INT , (uint8*)pstrM2mLsnInt, sizeof(tstrM2mLsnInt), NULL, 0, 0); 00701 } 00702 00703 sint8 m2m_wifi_set_cust_InfoElement(uint8* pau8M2mCustInfoElement) 00704 { 00705 00706 sint8 ret = M2M_ERR_FAIL; 00707 if(pau8M2mCustInfoElement != NULL) 00708 { 00709 if((pau8M2mCustInfoElement[0] + 1) < M2M_CUST_IE_LEN_MAX) 00710 { 00711 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); 00712 } 00713 } 00714 return ret; 00715 } 00716 00717 sint8 m2m_wifi_set_scan_options(tstrM2MScanOption* ptstrM2MScanOption) 00718 { 00719 sint8 s8Ret = M2M_ERR_FAIL; 00720 if(m2m_validate_scan_options (ptstrM2MScanOption) == M2M_SUCCESS) 00721 { 00722 s8Ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_SCAN_OPTION , (uint8*)ptstrM2MScanOption, sizeof(tstrM2MScanOption),NULL, 0,0); 00723 } 00724 return s8Ret; 00725 } 00726 sint8 m2m_wifi_set_scan_region(uint16 ScanRegion) 00727 { 00728 sint8 s8Ret = M2M_ERR_FAIL; 00729 tstrM2MScanRegion strScanRegion; 00730 strScanRegion.u16ScanRegion = ScanRegion; 00731 s8Ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_SCAN_REGION , (uint8*)&strScanRegion, sizeof(tstrM2MScanRegion),NULL, 0,0); 00732 return s8Ret; 00733 } 00734 sint8 m2m_wifi_request_scan(uint8 ch) 00735 { 00736 sint8 s8Ret = M2M_SUCCESS; 00737 00738 if(!gu8scanInProgress) 00739 { 00740 if(((ch >= M2M_WIFI_CH_1) && (ch <= M2M_WIFI_CH_14)) || (ch == M2M_WIFI_CH_ALL)) 00741 { 00742 tstrM2MScan strtmp; 00743 strtmp.u8ChNum = ch; 00744 s8Ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SCAN , (uint8*)&strtmp, sizeof(tstrM2MScan),NULL, 0,0); 00745 if(s8Ret == M2M_SUCCESS) 00746 { 00747 gu8scanInProgress = 1; 00748 } 00749 } 00750 else 00751 { 00752 s8Ret = M2M_ERR_INVALID_ARG; 00753 } 00754 } 00755 else 00756 { 00757 s8Ret = M2M_ERR_SCAN_IN_PROGRESS; 00758 } 00759 return s8Ret; 00760 } 00761 00762 sint8 m2m_wifi_request_scan_passive(uint8 ch, uint16 scan_time) 00763 { 00764 sint8 s8Ret = M2M_SUCCESS; 00765 00766 if(!gu8scanInProgress) 00767 { 00768 if(((ch >= M2M_WIFI_CH_1) && (ch <= M2M_WIFI_CH_14)) || (ch == M2M_WIFI_CH_ALL)) 00769 { 00770 tstrM2MScan strtmp; 00771 strtmp.u8ChNum = ch; 00772 00773 strtmp.u16PassiveScanTime = scan_time; 00774 00775 s8Ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_PASSIVE_SCAN , (uint8*)&strtmp, sizeof(tstrM2MScan),NULL, 0,0); 00776 if(s8Ret == M2M_SUCCESS) 00777 { 00778 gu8scanInProgress = 1; 00779 } 00780 } 00781 else 00782 { 00783 s8Ret = M2M_ERR_INVALID_ARG; 00784 } 00785 } 00786 else 00787 { 00788 s8Ret = M2M_ERR_SCAN_IN_PROGRESS; 00789 } 00790 return s8Ret; 00791 } 00792 00793 sint8 m2m_wifi_request_scan_ssid_list(uint8 ch,uint8 * u8Ssidlist) 00794 { 00795 sint8 s8Ret = M2M_ERR_INVALID_ARG; 00796 00797 if(!gu8scanInProgress) 00798 { 00799 if((((ch >= M2M_WIFI_CH_1) && (ch <= M2M_WIFI_CH_14)) || (ch == M2M_WIFI_CH_ALL))&&(u8Ssidlist != NULL)) 00800 { 00801 tstrM2MScan strtmp; 00802 uint16 u16Lsize = 0; 00803 uint8 u8Apnum = u8Ssidlist[u16Lsize]; 00804 if(u8Apnum <= MAX_HIDDEN_SITES) 00805 { 00806 u16Lsize++; 00807 while(u8Apnum) 00808 { 00809 if(u8Ssidlist[u16Lsize] >= M2M_MAX_SSID_LEN){ 00810 goto EXIT; 00811 }else { 00812 u16Lsize += u8Ssidlist[u16Lsize] + 1; 00813 u8Apnum--; 00814 } 00815 } 00816 strtmp.u8ChNum = ch; 00817 s8Ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SCAN_SSID_LIST |M2M_REQ_DATA_PKT, (uint8*)&strtmp, sizeof(tstrM2MScan),u8Ssidlist, u16Lsize,sizeof(tstrM2MScan)); 00818 if(s8Ret == M2M_SUCCESS) 00819 { 00820 gu8scanInProgress = 1; 00821 } 00822 } 00823 } 00824 } 00825 else 00826 { 00827 s8Ret = M2M_ERR_SCAN_IN_PROGRESS; 00828 } 00829 EXIT: 00830 return s8Ret; 00831 } 00832 sint8 m2m_wifi_wps(uint8 u8TriggerType,const char *pcPinNumber) 00833 { 00834 tstrM2MWPSConnect strtmp; 00835 00836 /* Stop Scan if it is ongoing. 00837 */ 00838 gu8scanInProgress = 0; 00839 strtmp.u8TriggerType = u8TriggerType; 00840 /*If WPS is using PIN METHOD*/ 00841 if (u8TriggerType == WPS_PIN_TRIGGER ) 00842 m2m_memcpy ((uint8*)strtmp.acPinNumber ,(uint8*) pcPinNumber,8); 00843 return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_WPS , (uint8*)&strtmp,sizeof(tstrM2MWPSConnect), NULL, 0,0); 00844 } 00845 sint8 m2m_wifi_wps_disable(void) 00846 { 00847 sint8 ret = M2M_SUCCESS; 00848 ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_DISABLE_WPS , NULL,0, NULL, 0, 0); 00849 return ret; 00850 } 00851 /*! 00852 @fn NMI_API sint8 m2m_wifi_req_client_ctrl(uint8 cmd); 00853 @brief Send a command to the PS Client (An WINC1500 board running the ps_firmware), 00854 if the PS client send any commands it will be received in wifi_cb M2M_WIFI_RESP_CLIENT_INFO 00855 @param [in] cmd 00856 Control command sent from PS Server to PS Client (command values defined by the application) 00857 @return The function SHALL return M2M_SUCCESE for success and a negative value otherwise. 00858 @sa m2m_wifi_req_server_init, M2M_WIFI_RESP_CLIENT_INFO 00859 @pre m2m_wifi_req_server_init should be called first 00860 @warning 00861 */ 00862 sint8 m2m_wifi_req_client_ctrl(uint8 u8Cmd) 00863 { 00864 00865 sint8 ret = M2M_SUCCESS; 00866 #ifdef _PS_SERVER_ 00867 tstrM2Mservercmd strCmd; 00868 strCmd.u8cmd = u8Cmd; 00869 ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_CLIENT_CTRL, (uint8*)&strCmd, sizeof(tstrM2Mservercmd), NULL, 0, 0); 00870 #else 00871 M2M_ERR("_PS_SERVER_ is not defined\n"); 00872 #endif 00873 return ret; 00874 } 00875 /*! 00876 @fn NMI_API sint8 m2m_wifi_req_server_init(uint8 ch); 00877 @brief Initialize the PS Server, The WINC1500 support Non secure communication with another WINC1500, 00878 (SERVER/CLIENT) through one byte command (probe request and probe response) without any connection setup 00879 @param [in] ch 00880 Server listening channel 00881 @return The function SHALL return M2M_SUCCESE for success and a negative value otherwise 00882 @sa m2m_wifi_req_client_ctrl 00883 @warning The server mode can't be used with any other modes (STA/P2P/AP) 00884 */ 00885 sint8 m2m_wifi_req_server_init(uint8 ch) 00886 { 00887 sint8 ret = M2M_SUCCESS; 00888 #ifdef _PS_SERVER_ 00889 tstrM2mServerInit strServer; 00890 strServer.u8Channel = ch; 00891 ret = hif_send(M2M_REQ_GROUP_WIFI,M2M_WIFI_REQ_SERVER_INIT, (uint8*)&strServer, sizeof(tstrM2mServerInit), NULL, 0, 0); 00892 #else 00893 M2M_ERR("_PS_SERVER_ is not defined\n"); 00894 #endif 00895 return ret; 00896 } 00897 sint8 m2m_wifi_p2p(uint8 u8Channel) 00898 { 00899 sint8 ret = M2M_SUCCESS; 00900 if((u8Channel == M2M_WIFI_CH_1) || (u8Channel == M2M_WIFI_CH_6) || (u8Channel == M2M_WIFI_CH_11)) 00901 { 00902 tstrM2MP2PConnect strtmp; 00903 strtmp.u8ListenChannel = u8Channel; 00904 ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_ENABLE_P2P , (uint8*)&strtmp, sizeof(tstrM2MP2PConnect), NULL, 0,0); 00905 } 00906 else 00907 { 00908 M2M_ERR("Listen channel should only be M2M_WIFI_CH_1/6/11 \n"); 00909 ret = M2M_ERR_FAIL; 00910 } 00911 return ret; 00912 } 00913 sint8 m2m_wifi_p2p_disconnect(void) 00914 { 00915 sint8 ret = M2M_SUCCESS; 00916 ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_DISABLE_P2P , NULL, 0, NULL, 0, 0); 00917 return ret; 00918 } 00919 sint8 m2m_wifi_enable_ap(CONST tstrM2MAPConfig* pstrM2MAPConfig) 00920 { 00921 sint8 ret = M2M_ERR_FAIL; 00922 if(M2M_SUCCESS == m2m_validate_ap_parameters(pstrM2MAPConfig)) 00923 { 00924 ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_ENABLE_AP , (uint8 *)pstrM2MAPConfig, sizeof(tstrM2MAPConfig), NULL, 0, 0); 00925 } 00926 return ret; 00927 } 00928 00929 sint8 m2m_wifi_set_gains(tstrM2mWifiGainsParams* pstrM2mGain) 00930 { 00931 sint8 ret = M2M_ERR_FAIL; 00932 if(pstrM2mGain != NULL) 00933 { 00934 ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_GAINS , (uint8 *)pstrM2mGain, sizeof(tstrM2mWifiGainsParams), NULL, 0, 0); 00935 } 00936 return ret; 00937 } 00938 sint8 m2m_wifi_disable_ap(void) 00939 { 00940 sint8 ret = M2M_SUCCESS; 00941 ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_DISABLE_AP , NULL, 0, NULL, 0, 0); 00942 return ret; 00943 } 00944 /*! 00945 @fn NMI_API sint8 m2m_wifi_req_curr_rssi(void); 00946 @brief Request the current RSSI for the current connected AP, 00947 the response received in wifi_cb M2M_WIFI_RESP_CURRENT_RSSI 00948 @sa M2M_WIFI_RESP_CURRENT_RSSI 00949 @return The function shall return M2M_SUCCESS for success and a negative value otherwise. 00950 */ 00951 sint8 m2m_wifi_req_curr_rssi(void) 00952 { 00953 sint8 ret = M2M_SUCCESS; 00954 ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_CURRENT_RSSI , NULL, 0, NULL,0, 0); 00955 return ret; 00956 } 00957 sint8 m2m_wifi_send_ethernet_pkt(uint8* pu8Packet,uint16 u16PacketSize) 00958 { 00959 sint8 s8Ret = -1; 00960 if((pu8Packet != NULL)&&(u16PacketSize>0)) 00961 { 00962 tstrM2MWifiTxPacketInfo strTxPkt; 00963 00964 strTxPkt.u16PacketSize = u16PacketSize; 00965 strTxPkt.u16HeaderLength = M2M_ETHERNET_HDR_LEN; 00966 s8Ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SEND_ETHERNET_PACKET | M2M_REQ_DATA_PKT, 00967 (uint8*)&strTxPkt, sizeof(tstrM2MWifiTxPacketInfo), pu8Packet, u16PacketSize, M2M_ETHERNET_HDR_OFFSET - M2M_HIF_HDR_OFFSET); 00968 } 00969 return s8Ret; 00970 } 00971 /*! 00972 @fn NMI_API sint8 m2m_wifi_get_otp_mac_address(uint8 *pu8MacAddr, uint8 * pu8IsValid); 00973 @brief Request the MAC address stored on the OTP (one time programmable) memory of the device. 00974 (the function is Blocking until response received) 00975 @param [out] pu8MacAddr 00976 Output MAC address buffer of 6 bytes size. Valid only if *pu8Valid=1. 00977 @param [out] pu8IsValid 00978 A output boolean value to indicate the validity of pu8MacAddr in OTP. 00979 Output zero if the OTP memory is not programmed, non-zero otherwise. 00980 @return The function shall return M2M_SUCCESS for success and a negative value otherwise. 00981 @sa m2m_wifi_get_mac_address 00982 @pre m2m_wifi_init required to call any WIFI/socket function 00983 */ 00984 sint8 m2m_wifi_get_otp_mac_address(uint8 *pu8MacAddr, uint8* pu8IsValid) 00985 { 00986 sint8 ret = M2M_SUCCESS; 00987 ret = hif_chip_wake(); 00988 if(ret == M2M_SUCCESS) 00989 { 00990 ret = nmi_get_otp_mac_address(pu8MacAddr, pu8IsValid); 00991 if(ret == M2M_SUCCESS) 00992 { 00993 ret = hif_chip_sleep(); 00994 } 00995 } 00996 return ret; 00997 } 00998 /*! 00999 @fn NMI_API sint8 m2m_wifi_get_mac_address(uint8 *pu8MacAddr) 01000 @brief Request the current MAC address of the device (the working mac address). 01001 (the function is Blocking until response received) 01002 @param [out] pu8MacAddr 01003 Output MAC address buffer of 6 bytes size. 01004 @return The function shall return M2M_SUCCESS for success and a negative value otherwise. 01005 @sa m2m_wifi_get_otp_mac_address 01006 @pre m2m_wifi_init required to call any WIFI/socket function 01007 */ 01008 sint8 m2m_wifi_get_mac_address(uint8 *pu8MacAddr) 01009 { 01010 sint8 ret = M2M_SUCCESS; 01011 ret = hif_chip_wake(); 01012 if(ret == M2M_SUCCESS) 01013 { 01014 ret = nmi_get_mac_address(pu8MacAddr); 01015 if(ret == M2M_SUCCESS) 01016 { 01017 ret = hif_chip_sleep(); 01018 } 01019 } 01020 01021 return ret; 01022 } 01023 /*! 01024 @fn NMI_API sint8 m2m_wifi_req_scan_result(uint8 index); 01025 @brief Reads the AP information from the Scan Result list with the given index, 01026 the response received in wifi_cb M2M_WIFI_RESP_SCAN_RESULT, 01027 the response pointer should be casted with tstrM2mWifiscanResult structure 01028 @param [in] index 01029 Index for the requested result, the index range start from 0 till number of AP's found 01030 @sa tstrM2mWifiscanResult,m2m_wifi_get_num_ap_found,m2m_wifi_request_scan 01031 @return The function shall return M2M_SUCCESE for success and a negative value otherwise 01032 @pre m2m_wifi_request_scan need to be called first, then m2m_wifi_get_num_ap_found 01033 to get the number of AP's found 01034 @warning Function used only in STA mode only. the scan result updated only if scan request called, 01035 else it will be cashed in firmware for the host scan request result, 01036 which mean if large delay occur between the scan request and the scan result request, 01037 the result will not be up-to-date 01038 */ 01039 01040 sint8 m2m_wifi_req_scan_result(uint8 index) 01041 { 01042 sint8 ret = M2M_SUCCESS; 01043 tstrM2mReqScanResult strReqScanRlt; 01044 strReqScanRlt.u8Index = index; 01045 ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SCAN_RESULT , (uint8*) &strReqScanRlt, sizeof(tstrM2mReqScanResult), NULL, 0, 0); 01046 return ret; 01047 } 01048 /*! 01049 @fn NMI_API uint8 m2m_wifi_get_num_ap_found(void); 01050 @brief Reads the number of AP's found in the last Scan Request, 01051 The function read the number of AP's from global variable which updated in the 01052 wifi_cb in M2M_WIFI_RESP_SCAN_DONE. 01053 @sa m2m_wifi_request_scan 01054 @return Return the number of AP's found in the last Scan Request. 01055 @pre m2m_wifi_request_scan need to be called first 01056 @warning That function need to be called in the wifi_cb in M2M_WIFI_RESP_SCAN_DONE, 01057 calling that function in any other place will return undefined/undated numbers. 01058 Function used only in STA mode only. 01059 */ 01060 uint8 m2m_wifi_get_num_ap_found(void) 01061 { 01062 return gu8ChNum; 01063 } 01064 /*! 01065 @fn NMI_API uint8 m2m_wifi_get_sleep_mode(void); 01066 @brief Get the current Power save mode. 01067 @return The current operating power saving mode. 01068 @sa tenuPowerSaveModes , m2m_wifi_set_sleep_mode 01069 */ 01070 uint8 m2m_wifi_get_sleep_mode(void) 01071 { 01072 return hif_get_sleep_mode(); 01073 } 01074 /*! 01075 @fn NMI_API sint8 m2m_wifi_set_sleep_mode(uint8 PsTyp, uint8 BcastEn); 01076 @brief Set the power saving mode for the WINC1500. 01077 @param [in] PsTyp 01078 Desired power saving mode. Supported types are defined in tenuPowerSaveModes. 01079 @param [in] BcastEn 01080 Broadcast reception enable flag. 01081 If it is 1, the WINC1500 must be awake each DTIM Beacon for receiving Broadcast traffic. 01082 If it is 0, the WINC1500 will not wakeup at the DTIM Beacon, but its wakeup depends only 01083 on the the configured Listen Interval. 01084 @return The function SHALL return 0 for success and a negative value otherwise. 01085 @sa tenuPowerSaveModes 01086 @warning The function called once after initialization. 01087 */ 01088 sint8 m2m_wifi_set_sleep_mode(uint8 PsTyp, uint8 BcastEn) 01089 { 01090 sint8 ret = M2M_SUCCESS; 01091 tstrM2mPsType strPs; 01092 strPs.u8PsType = PsTyp; 01093 strPs.u8BcastEn = BcastEn; 01094 ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SLEEP , (uint8*) &strPs,sizeof(tstrM2mPsType), NULL, 0, 0); 01095 M2M_INFO("POWER SAVE %d\n",PsTyp); 01096 hif_set_sleep_mode(PsTyp); 01097 return ret; 01098 } 01099 /*! 01100 @fn NMI_API sint8 m2m_wifi_request_sleep(void) 01101 @brief Request from WINC1500 device to Sleep for specific time in the M2M_PS_MANUAL Power save mode (only). 01102 @param [in] u32SlpReqTime 01103 Request Sleep in ms 01104 @return The function SHALL return M2M_SUCCESS for success and a negative value otherwise. 01105 @sa tenuPowerSaveModes , m2m_wifi_set_sleep_mode 01106 @warning the Function should be called in M2M_PS_MANUAL power save only 01107 */ 01108 sint8 m2m_wifi_request_sleep(uint32 u32SlpReqTime) 01109 { 01110 sint8 ret = M2M_SUCCESS; 01111 uint8 psType; 01112 psType = hif_get_sleep_mode(); 01113 if(psType == M2M_PS_MANUAL ) 01114 { 01115 tstrM2mSlpReqTime strPs; 01116 strPs.u32SleepTime = u32SlpReqTime; 01117 ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_DOZE , (uint8*) &strPs,sizeof(tstrM2mSlpReqTime), NULL, 0, 0); 01118 } 01119 return ret; 01120 } 01121 /*! 01122 @fn NMI_API sint8 m2m_wifi_set_device_name(uint8 *pu8DeviceName, uint8 u8DeviceNameLength); 01123 @brief Set the WINC1500 device name which is used as P2P device name. 01124 @param [in] pu8DeviceName 01125 Buffer holding the device name. 01126 @param [in] u8DeviceNameLength 01127 Length of the device name. 01128 @return The function SHALL return M2M_SUCCESS for success and a negative value otherwise. 01129 @warning The Function called once after initialization. 01130 */ 01131 sint8 m2m_wifi_set_device_name(uint8 *pu8DeviceName, uint8 u8DeviceNameLength) 01132 { 01133 tstrM2MDeviceNameConfig strDeviceName; 01134 if(u8DeviceNameLength >= M2M_DEVICE_NAME_MAX) 01135 { 01136 u8DeviceNameLength = M2M_DEVICE_NAME_MAX; 01137 } 01138 //pu8DeviceName[u8DeviceNameLength] = '\0'; 01139 u8DeviceNameLength ++; 01140 m2m_memcpy(strDeviceName.au8DeviceName , pu8DeviceName, u8DeviceNameLength); 01141 return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_DEVICE_NAME , 01142 (uint8*)&strDeviceName, sizeof(tstrM2MDeviceNameConfig), NULL, 0,0); 01143 } 01144 sint8 m2m_wifi_get_firmware_version(tstrM2mRev *pstrRev) 01145 { 01146 sint8 ret = M2M_SUCCESS; 01147 ret = hif_chip_wake(); 01148 if(ret == M2M_SUCCESS) 01149 { 01150 ret = nm_get_firmware_full_info(pstrRev); 01151 hif_chip_sleep(); 01152 } 01153 return ret; 01154 } 01155 #ifdef CONF_MGMT 01156 sint8 m2m_wifi_enable_monitoring_mode(tstrM2MWifiMonitorModeCtrl *pstrMtrCtrl, uint8 *pu8PayloadBuffer, 01157 uint16 u16BufferSize, uint16 u16DataOffset) 01158 { 01159 sint8 s8Ret = -1; 01160 if((pstrMtrCtrl->u8ChannelID >= M2M_WIFI_CH_1) && (pstrMtrCtrl->u8ChannelID <= M2M_WIFI_CH_14)) 01161 { 01162 gstrMgmtCtrl.pu8Buf = pu8PayloadBuffer; 01163 gstrMgmtCtrl.u16Sz = u16BufferSize; 01164 gstrMgmtCtrl.u16Offset = u16DataOffset; 01165 s8Ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_ENABLE_MONITORING , 01166 (uint8*)pstrMtrCtrl, sizeof(tstrM2MWifiMonitorModeCtrl), NULL, 0,0); 01167 } 01168 return s8Ret; 01169 } 01170 01171 sint8 m2m_wifi_disable_monitoring_mode(void) 01172 { 01173 return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_DISABLE_MONITORING , NULL, 0, NULL, 0,0); 01174 } 01175 01176 sint8 m2m_wifi_send_wlan_pkt(uint8 *pu8WlanPacket, uint16 u16WlanHeaderLength, uint16 u16WlanPktSize) 01177 { 01178 sint8 s8Ret = -1; 01179 if(pu8WlanPacket != NULL) 01180 { 01181 tstrM2MWifiTxPacketInfo strTxPkt; 01182 01183 strTxPkt.u16PacketSize = u16WlanPktSize; 01184 strTxPkt.u16HeaderLength = u16WlanHeaderLength; 01185 s8Ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SEND_WIFI_PACKET | M2M_REQ_DATA_PKT, 01186 (uint8*)&strTxPkt, sizeof(tstrM2MWifiTxPacketInfo), pu8WlanPacket, u16WlanPktSize, sizeof(tstrM2MWifiTxPacketInfo)); 01187 } 01188 return s8Ret; 01189 } 01190 #endif 01191 01192 sint8 m2m_wifi_start_provision_mode(tstrM2MAPConfig *pstrAPConfig, char *pcHttpServerDomainName, uint8 bEnableHttpRedirect) 01193 { 01194 sint8 s8Ret = M2M_ERR_FAIL; 01195 01196 if((pstrAPConfig != NULL)) 01197 { 01198 tstrM2MProvisionModeConfig strProvConfig; 01199 if(M2M_SUCCESS == m2m_validate_ap_parameters(pstrAPConfig)) 01200 { 01201 m2m_memcpy((uint8*)&strProvConfig.strApConfig , (uint8*)pstrAPConfig, sizeof(tstrM2MAPConfig)); 01202 if((m2m_strlen((uint8 *)pcHttpServerDomainName) <= 0) || (NULL == pcHttpServerDomainName)) 01203 { 01204 M2M_ERR("INVALID DOMAIN NAME\n"); 01205 goto ERR1; 01206 } 01207 m2m_memcpy((uint8*)strProvConfig.acHttpServerDomainName , (uint8*)pcHttpServerDomainName, 64); 01208 strProvConfig.u8EnableRedirect = bEnableHttpRedirect; 01209 01210 /* Stop Scan if it is ongoing. 01211 */ 01212 gu8scanInProgress = 0; 01213 s8Ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_START_PROVISION_MODE | M2M_REQ_DATA_PKT, 01214 (uint8*)&strProvConfig, sizeof(tstrM2MProvisionModeConfig), NULL, 0, 0); 01215 } 01216 else 01217 { 01218 /*goto ERR1;*/ 01219 } 01220 } 01221 ERR1: 01222 return s8Ret; 01223 } 01224 01225 sint8 m2m_wifi_stop_provision_mode(void) 01226 { 01227 return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_STOP_PROVISION_MODE , NULL, 0, NULL, 0, 0); 01228 } 01229 01230 sint8 m2m_wifi_get_connection_info(void) 01231 { 01232 return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_GET_CONN_INFO , NULL, 0, NULL, 0, 0); 01233 } 01234 01235 sint8 m2m_wifi_set_sytem_time(uint32 u32UTCSeconds) 01236 { 01237 /* 01238 The firmware accepts timestamps relative to 1900 like NTP Timestamp. 01239 */ 01240 return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_SYS_TIME , (uint8*)&u32UTCSeconds, sizeof(tstrSystemTime), NULL, 0, 0); 01241 } 01242 /*! 01243 * @fn NMI_API sint8 m2m_wifi_get_sytem_time(void); 01244 * @see m2m_wifi_enable_sntp 01245 tstrSystemTime 01246 * @note get the system time from the sntp client 01247 * using the API \ref m2m_wifi_get_sytem_time. 01248 * @return The function returns @ref M2M_SUCCESS for successful operations and a negative value otherwise. 01249 */ 01250 sint8 m2m_wifi_get_sytem_time (void) 01251 { 01252 return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_GET_SYS_TIME , NULL,0, NULL, 0, 0); 01253 } 01254 01255 sint8 m2m_wifi_enable_sntp(uint8 bEnable) 01256 { 01257 uint8 u8Req; 01258 01259 u8Req = bEnable ? M2M_WIFI_REQ_ENABLE_SNTP_CLIENT : M2M_WIFI_REQ_DISABLE_SNTP_CLIENT ; 01260 return hif_send(M2M_REQ_GROUP_WIFI, u8Req, NULL, 0, NULL, 0, 0); 01261 } 01262 /*! 01263 @fn NMI_API sint8 m2m_wifi_set_power_profile(uint8 u8PwrMode); 01264 @brief Change the power profile mode 01265 @param [in] u8PwrMode 01266 Change the WINC power profile to different mode 01267 PWR_LOW1/PWR_LOW2/PWR_HIGH/PWR_AUTO (tenuM2mPwrMode) 01268 @return The function SHALL return M2M_SUCCESE for success and a negative value otherwise. 01269 @sa tenuM2mPwrMode 01270 @pre m2m_wifi_init 01271 @warning must be called after the initializations and before any connection request and can't be changed in run time, 01272 */ 01273 sint8 m2m_wifi_set_power_profile(uint8 u8PwrMode) 01274 { 01275 sint8 ret = M2M_SUCCESS; 01276 tstrM2mPwrMode strM2mPwrMode; 01277 strM2mPwrMode.u8PwrMode = u8PwrMode; 01278 ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_POWER_PROFILE , (uint8*)&strM2mPwrMode,sizeof(tstrM2mPwrMode), NULL, 0, 0); 01279 return ret; 01280 } 01281 /*! 01282 @fn NMI_API sint8 m2m_wifi_set_tx_power(uint8 u8TxPwrLevel); 01283 @brief set the TX power tenuM2mTxPwrLevel 01284 @param [in] u8TxPwrLevel 01285 change the TX power tenuM2mTxPwrLevel 01286 @return The function SHALL return M2M_SUCCESE for success and a negative value otherwise. 01287 @sa tenuM2mTxPwrLevel 01288 @pre m2m_wifi_init 01289 @warning 01290 */ 01291 sint8 m2m_wifi_set_tx_power(uint8 u8TxPwrLevel) 01292 { 01293 sint8 ret = M2M_SUCCESS; 01294 tstrM2mTxPwrLevel strM2mTxPwrLevel; 01295 strM2mTxPwrLevel.u8TxPwrLevel = u8TxPwrLevel; 01296 ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_TX_POWER , (uint8*)&strM2mTxPwrLevel,sizeof(tstrM2mTxPwrLevel), NULL, 0, 0); 01297 return ret; 01298 } 01299 01300 /*! 01301 @fn NMI_API sint8 m2m_wifi_enable_firmware_logs(uint8 u8Enable); 01302 @brief Enable or Disable logs in run time (Disable Firmware logs will 01303 enhance the firmware start-up time and performance) 01304 @param [in] u8Enable 01305 Set 1 to enable the logs 0 for disable 01306 @return The function SHALL return M2M_SUCCESE for success and a negative value otherwise. 01307 @sa __DISABLE_FIRMWARE_LOGS__ (build option to disable logs from initializations) 01308 @pre m2m_wifi_init 01309 @warning 01310 */ 01311 sint8 m2m_wifi_enable_firmware_logs(uint8 u8Enable) 01312 { 01313 sint8 ret = M2M_SUCCESS; 01314 tstrM2mEnableLogs strM2mEnableLogs; 01315 strM2mEnableLogs.u8Enable = u8Enable; 01316 ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_ENABLE_LOGS , (uint8*)&strM2mEnableLogs,sizeof(tstrM2mEnableLogs), NULL, 0, 0); 01317 return ret; 01318 } 01319 01320 /*! 01321 @fn NMI_API sint8 m2m_wifi_set_battery_voltage(uint16 u16BattVoltx100); 01322 @brief Enable or Disable logs in run time (Disable Firmware logs will 01323 enhance the firmware start-up time and performance) 01324 @param [in] u16BattVoltx100 01325 battery voltage multiplied by 100 01326 @return The function SHALL return M2M_SUCCESE for success and a negative value otherwise. 01327 @sa __DISABLE_FIRMWARE_LOGS__ (build option to disable logs from initializations) 01328 @pre m2m_wifi_init 01329 @warning 01330 */ 01331 sint8 m2m_wifi_set_battery_voltage(uint16 u16BattVoltx100) 01332 { 01333 sint8 ret = M2M_SUCCESS; 01334 tstrM2mBatteryVoltage strM2mBattVol = {0}; 01335 strM2mBattVol.u16BattVolt = u16BattVoltx100; 01336 ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_BATTERY_VOLTAGE , (uint8*)&strM2mBattVol,sizeof(tstrM2mBatteryVoltage), NULL, 0, 0); 01337 return ret; 01338 } 01339 /*! 01340 @fn sint8 m2m_wifi_prng_get_random_bytes(uint8 * pu8PrngBuff,uint16 u16PrngSize) 01341 @brief Get random bytes using the PRNG bytes. 01342 @param [in] u16PrngSize 01343 Size of the required random bytes to be generated. 01344 @param [in] pu8PrngBuff 01345 Pointer to user allocated buffer. 01346 @return The function SHALL return M2M_SUCCESE for success and a negative value otherwise. 01347 */ 01348 sint8 m2m_wifi_prng_get_random_bytes(uint8 * pu8PrngBuff,uint16 u16PrngSize) 01349 { 01350 sint8 ret = M2M_ERR_FAIL; 01351 tstrPrng strRng = {0}; 01352 if((u16PrngSize < (M2M_BUFFER_MAX_SIZE - sizeof(tstrPrng)))&&(pu8PrngBuff != NULL)) 01353 { 01354 strRng.u16PrngSize = u16PrngSize; 01355 strRng.pu8RngBuff = pu8PrngBuff; 01356 ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_GET_PRNG |M2M_REQ_DATA_PKT,(uint8 *)&strRng, sizeof(tstrPrng),NULL,0, 0); 01357 } 01358 else 01359 { 01360 M2M_ERR("PRNG Buffer exceeded maximum size %d or NULL Buffer\n",u16PrngSize); 01361 } 01362 return ret; 01363 } 01364 #ifdef ETH_MODE 01365 /*! 01366 @fn \ 01367 NMI_API sint8 m2m_wifi_enable_mac_mcast(uint8* pu8MulticastMacAddress, uint8 u8AddRemove) 01368 01369 @brief 01370 Add MAC filter to receive Multicast packets. 01371 01372 @param [in] pu8MulticastMacAddress 01373 Pointer to the MAC address. 01374 @param [in] u8AddRemove 01375 Flag to Add/Remove MAC address. 01376 @return 01377 The function SHALL return 0 for success and a negative value otherwise. 01378 */ 01379 01380 NMI_API sint8 m2m_wifi_enable_mac_mcast(uint8* pu8MulticastMacAddress, uint8 u8AddRemove) 01381 { 01382 sint8 s8ret = M2M_ERR_FAIL; 01383 tstrM2MMulticastMac strMulticastMac; 01384 01385 if(pu8MulticastMacAddress != NULL ) 01386 { 01387 strMulticastMac.u8AddRemove = u8AddRemove; 01388 m2m_memcpy(strMulticastMac.au8macaddress ,pu8MulticastMacAddress,M2M_MAC_ADDRES_LEN); 01389 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]); 01390 s8ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_MAC_MCAST , (uint8 *)&strMulticastMac,sizeof(tstrM2MMulticastMac),NULL,0,0); 01391 } 01392 01393 return s8ret; 01394 01395 } 01396 01397 /*! 01398 @fn \ 01399 NMI_API sint8 m2m_wifi_set_receive_buffer(void* pvBuffer,uint16 u16BufferLen); 01400 01401 @brief 01402 set the ethernet receive buffer, should be called in the receive call back. 01403 01404 @param [in] pvBuffer 01405 Pointer to the ethernet receive buffer. 01406 @param [in] u16BufferLen 01407 Length of the buffer. 01408 01409 @return 01410 The function SHALL return 0 for success and a negative value otherwise. 01411 */ 01412 NMI_API sint8 m2m_wifi_set_receive_buffer(void* pvBuffer,uint16 u16BufferLen) 01413 { 01414 sint8 s8ret = M2M_SUCCESS; 01415 if(pvBuffer != NULL) 01416 { 01417 gau8ethRcvBuf = pvBuffer; 01418 gu16ethRcvBufSize= u16BufferLen; 01419 } 01420 else 01421 { 01422 s8ret = M2M_ERR_FAIL; 01423 M2M_ERR("Buffer NULL pointer\r\n"); 01424 } 01425 return s8ret; 01426 } 01427 #endif /* ETH_MODE */ 01428
Generated on Wed Jul 13 2022 16:32:37 by
1.7.2