DeepCover Embedded Security in IoT: Public-key Secured Data Paths
Dependencies: MaximInterface
device.c
00001 /* 00002 * device.c - CC31xx/CC32xx Host Driver Implementation 00003 * 00004 * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/ 00005 * 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 00014 * Redistributions in binary form must reproduce the above copyright 00015 * notice, this list of conditions and the following disclaimer in the 00016 * documentation and/or other materials provided with the 00017 * distribution. 00018 * 00019 * Neither the name of Texas Instruments Incorporated nor the names of 00020 * its contributors may be used to endorse or promote products derived 00021 * from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00026 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00027 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00028 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00029 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00030 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00031 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00032 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00033 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 */ 00036 00037 00038 00039 /*****************************************************************************/ 00040 /* Include files */ 00041 /*****************************************************************************/ 00042 #include "simplelink.h" 00043 #include "protocol.h" 00044 #include "flowcont.h" 00045 #include "driver.h" 00046 #include "wlan.h" 00047 00048 00049 /*****************************************************************************/ 00050 /* Internal functions */ 00051 /*****************************************************************************/ 00052 00053 static SlWlanMode_e _sl_GetStartResponseConvert(_i32 Status); 00054 00055 00056 static const SlWlanMode_e StartResponseLUT[8] = 00057 { 00058 ROLE_UNKNOWN, 00059 ROLE_STA, 00060 ROLE_STA_ERR, 00061 ROLE_AP, 00062 ROLE_AP_ERR, 00063 ROLE_P2P, 00064 ROLE_P2P_ERR, 00065 INIT_CALIB_FAIL 00066 }; 00067 00068 00069 static SlWlanMode_e _sl_GetStartResponseConvert(_i32 Status) 00070 { 00071 return StartResponseLUT[Status & 0x7]; 00072 } 00073 00074 00075 /*****************************************************************************/ 00076 /* API Functions */ 00077 /*****************************************************************************/ 00078 00079 00080 00081 /*****************************************************************************/ 00082 /* sl_Task */ 00083 /*****************************************************************************/ 00084 #if _SL_INCLUDE_FUNC(sl_Task) 00085 void sl_Task(void) 00086 { 00087 #ifdef _SlTaskEntry 00088 (void)_SlTaskEntry(); 00089 #endif 00090 } 00091 #endif 00092 00093 /*****************************************************************************/ 00094 /* sl_Start */ 00095 /*****************************************************************************/ 00096 #if _SL_INCLUDE_FUNC(sl_Start) 00097 _i16 sl_Start(const void* pIfHdl, _i8* pDevName, const P_INIT_CALLBACK pInitCallBack) 00098 { 00099 _u8 ObjIdx = MAX_CONCURRENT_ACTIONS; 00100 InitComplete_t AsyncRsp; 00101 00102 /* verify no erorr handling in progress. if in progress than 00103 ignore the API execution and return immediately with an error */ 00104 VERIFY_NO_ERROR_HANDLING_IN_PROGRESS(); 00105 /* Perform any preprocessing before enable networking services */ 00106 #ifdef sl_DeviceEnablePreamble 00107 sl_DeviceEnablePreamble(); 00108 #endif 00109 00110 /* ControlBlock init */ 00111 (void)_SlDrvDriverCBInit(); 00112 00113 /* open the interface: usually SPI or UART */ 00114 if (NULL == pIfHdl) 00115 { 00116 g_pCB->FD = sl_IfOpen((void *)pDevName, 0); 00117 } 00118 else 00119 { 00120 g_pCB->FD = (_SlFd_t)pIfHdl; 00121 } 00122 00123 ObjIdx = _SlDrvProtectAsyncRespSetting((_u8 *)&AsyncRsp, START_STOP_ID, SL_MAX_SOCKETS); 00124 00125 if (MAX_CONCURRENT_ACTIONS == ObjIdx) 00126 { 00127 return SL_POOL_IS_EMPTY; 00128 } 00129 00130 if( g_pCB->FD >= (_SlFd_t)0) 00131 { 00132 sl_DeviceDisable(); 00133 00134 sl_IfRegIntHdlr((SL_P_EVENT_HANDLER)_SlDrvRxIrqHandler, NULL); 00135 00136 g_pCB->pInitCallback = pInitCallBack; 00137 00138 sl_DeviceEnable(); 00139 00140 if (NULL == pInitCallBack) 00141 { 00142 #ifdef SL_TINY_EXT 00143 _SlDrvSyncObjWaitForever(&g_pCB->ObjPool[ObjIdx].SyncObj); 00144 #else 00145 _SlReturnVal_t retVal; 00146 retVal = _SlDrvSyncObjWaitTimeout(&g_pCB->ObjPool[ObjIdx].SyncObj, 00147 INIT_COMPLETE_TIMEOUT, 00148 SL_DRIVER_API_DEVICE_SL_START); 00149 if (retVal) 00150 { 00151 return SL_API_ABORTED; 00152 } 00153 #endif 00154 00155 00156 /* release Pool Object */ 00157 _SlDrvReleasePoolObj(g_pCB->FunctionParams.AsyncExt.ActionIndex); 00158 return _sl_GetStartResponseConvert(AsyncRsp.Status); 00159 } 00160 else 00161 { 00162 return SL_RET_CODE_OK; 00163 } 00164 } 00165 return SL_BAD_INTERFACE; 00166 } 00167 #endif 00168 00169 /*************************************************************************** 00170 _sl_HandleAsync_InitComplete - handles init complete signalling to 00171 a waiting object 00172 ****************************************************************************/ 00173 _SlReturnVal_t _sl_HandleAsync_InitComplete(void *pVoidBuf) 00174 { 00175 InitComplete_t *pMsgArgs = (InitComplete_t *)_SL_RESP_ARGS_START(pVoidBuf); 00176 00177 SL_DRV_PROTECTION_OBJ_LOCK_FOREVER(); 00178 00179 if(g_pCB->pInitCallback) 00180 { 00181 g_pCB->pInitCallback(_sl_GetStartResponseConvert(pMsgArgs->Status)); 00182 } 00183 else 00184 { 00185 sl_Memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(InitComplete_t)); 00186 SL_DRV_SYNC_OBJ_SIGNAL(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); 00187 } 00188 00189 SL_DRV_PROTECTION_OBJ_UNLOCK(); 00190 00191 if(g_pCB->pInitCallback) 00192 { 00193 _SlDrvReleasePoolObj(g_pCB->FunctionParams.AsyncExt.ActionIndex); 00194 } 00195 00196 00197 return SL_RET_CODE_OK; 00198 } 00199 00200 /*************************************************************************** 00201 _sl_HandleAsync_Stop - handles stop signalling to 00202 a waiting object 00203 ****************************************************************************/ 00204 void _sl_HandleAsync_Stop(void *pVoidBuf) 00205 { 00206 _BasicResponse_t *pMsgArgs = (_BasicResponse_t *)_SL_RESP_ARGS_START(pVoidBuf); 00207 00208 VERIFY_SOCKET_CB(NULL != g_pCB->StopCB.pAsyncRsp); 00209 00210 SL_DRV_PROTECTION_OBJ_LOCK_FOREVER(); 00211 00212 sl_Memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_BasicResponse_t)); 00213 00214 SL_DRV_SYNC_OBJ_SIGNAL(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); 00215 SL_DRV_PROTECTION_OBJ_UNLOCK(); 00216 00217 return; 00218 } 00219 00220 00221 /***************************************************************************** 00222 sl_stop 00223 ******************************************************************************/ 00224 typedef union 00225 { 00226 _DevStopCommand_t Cmd; 00227 _BasicResponse_t Rsp; 00228 }_SlStopMsg_u; 00229 00230 static const _SlCmdCtrl_t _SlStopCmdCtrl = 00231 { 00232 SL_OPCODE_DEVICE_STOP_COMMAND, 00233 (_SlArgSize_t)sizeof(_DevStopCommand_t), 00234 (_SlArgSize_t)sizeof(_BasicResponse_t) 00235 }; 00236 00237 #if _SL_INCLUDE_FUNC(sl_Stop) 00238 _i16 sl_Stop(const _u16 timeout) 00239 { 00240 _i16 RetVal=0; 00241 _SlStopMsg_u Msg; 00242 _BasicResponse_t AsyncRsp; 00243 _u8 ObjIdx = MAX_CONCURRENT_ACTIONS; 00244 00245 /* If we are in the middle of assert handling then ignore stopping 00246 * the device with timeout and force immediate shutdown as we would like 00247 * to avoid any additional commands to the NWP */ 00248 if( (timeout != 0) 00249 #ifndef SL_TINY_EXT 00250 && ((_u8)FALSE == g_bDeviceRestartIsRequired) 00251 #endif 00252 ) 00253 { 00254 /* let the device make the shutdown using the defined timeout */ 00255 Msg.Cmd.Timeout = timeout; 00256 00257 ObjIdx = _SlDrvProtectAsyncRespSetting((_u8 *)&AsyncRsp, START_STOP_ID, SL_MAX_SOCKETS); 00258 if (MAX_CONCURRENT_ACTIONS == ObjIdx) 00259 { 00260 return SL_POOL_IS_EMPTY; 00261 } 00262 00263 VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlStopCmdCtrl, &Msg, NULL)); 00264 00265 if(SL_OS_RET_CODE_OK == (_i16)Msg.Rsp.status) 00266 { 00267 00268 #ifdef SL_TINY_EXT 00269 _SlDrvSyncObjWaitForever(&g_pCB->ObjPool[ObjIdx].SyncObj); 00270 /* Wait for sync object to be signaled */ 00271 #else 00272 SL_DRV_SYNC_OBJ_WAIT_TIMEOUT(&g_pCB->ObjPool[ObjIdx].SyncObj, 00273 STOP_DEVICE_TIMEOUT, 00274 SL_DRIVER_API_DEVICE_SL_STOP); 00275 #endif 00276 00277 Msg.Rsp.status = AsyncRsp.status; 00278 RetVal = Msg.Rsp.status; 00279 } 00280 _SlDrvReleasePoolObj(ObjIdx); 00281 } 00282 00283 sl_IfRegIntHdlr(NULL, NULL); 00284 sl_DeviceDisable(); 00285 RetVal = sl_IfClose(g_pCB->FD); 00286 00287 (void)_SlDrvDriverCBDeinit(); 00288 00289 #ifndef SL_TINY_EXT 00290 /* Clear the restart device flag */ 00291 g_bDeviceRestartIsRequired = FALSE; 00292 #endif 00293 00294 return RetVal; 00295 } 00296 #endif 00297 00298 00299 /***************************************************************************** 00300 sl_EventMaskSet 00301 *****************************************************************************/ 00302 typedef union 00303 { 00304 _DevMaskEventSetCommand_t Cmd; 00305 _BasicResponse_t Rsp; 00306 }_SlEventMaskSetMsg_u; 00307 00308 00309 00310 00311 #if _SL_INCLUDE_FUNC(sl_EventMaskSet) 00312 00313 static const _SlCmdCtrl_t _SlEventMaskSetCmdCtrl = 00314 { 00315 SL_OPCODE_DEVICE_EVENTMASKSET, 00316 (_SlArgSize_t)sizeof(_DevMaskEventSetCommand_t), 00317 (_SlArgSize_t)sizeof(_BasicResponse_t) 00318 }; 00319 00320 00321 _i16 sl_EventMaskSet(const _u8 EventClass ,const _u32 Mask) 00322 { 00323 _SlEventMaskSetMsg_u Msg; 00324 00325 /* verify no erorr handling in progress. if in progress than 00326 ignore the API execution and return immediately with an error */ 00327 VERIFY_NO_ERROR_HANDLING_IN_PROGRESS(); 00328 00329 Msg.Cmd.group = EventClass; 00330 Msg.Cmd.mask = Mask; 00331 00332 VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlEventMaskSetCmdCtrl, &Msg, NULL)); 00333 00334 return (_i16)Msg.Rsp.status; 00335 } 00336 #endif 00337 00338 /****************************************************************************** 00339 sl_EventMaskGet 00340 ******************************************************************************/ 00341 typedef union 00342 { 00343 _DevMaskEventGetCommand_t Cmd; 00344 _DevMaskEventGetResponse_t Rsp; 00345 }_SlEventMaskGetMsg_u; 00346 00347 00348 00349 #if _SL_INCLUDE_FUNC(sl_EventMaskGet) 00350 00351 static const _SlCmdCtrl_t _SlEventMaskGetCmdCtrl = 00352 { 00353 SL_OPCODE_DEVICE_EVENTMASKGET, 00354 (_SlArgSize_t)sizeof(_DevMaskEventGetCommand_t), 00355 (_SlArgSize_t)sizeof(_DevMaskEventGetResponse_t) 00356 }; 00357 00358 00359 _i16 sl_EventMaskGet(const _u8 EventClass,_u32 *pMask) 00360 { 00361 _SlEventMaskGetMsg_u Msg; 00362 00363 /* verify no erorr handling in progress. if in progress than 00364 ignore the API execution and return immediately with an error */ 00365 VERIFY_NO_ERROR_HANDLING_IN_PROGRESS(); 00366 Msg.Cmd.group = EventClass; 00367 00368 VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlEventMaskGetCmdCtrl, &Msg, NULL)); 00369 00370 *pMask = Msg.Rsp.mask; 00371 return SL_RET_CODE_OK; 00372 } 00373 #endif 00374 00375 00376 00377 /****************************************************************************** 00378 sl_DevGet 00379 ******************************************************************************/ 00380 00381 typedef union 00382 { 00383 _DeviceSetGet_t Cmd; 00384 _DeviceSetGet_t Rsp; 00385 }_SlDeviceMsgGet_u; 00386 00387 00388 00389 #if _SL_INCLUDE_FUNC(sl_DevGet) 00390 00391 static const _SlCmdCtrl_t _SlDeviceGetCmdCtrl = 00392 { 00393 SL_OPCODE_DEVICE_DEVICEGET, 00394 (_SlArgSize_t)sizeof(_DeviceSetGet_t), 00395 (_SlArgSize_t)sizeof(_DeviceSetGet_t) 00396 }; 00397 00398 _i32 sl_DevGet(const _u8 DeviceGetId,_u8 *pOption,_u8 *pConfigLen, _u8 *pValues) 00399 { 00400 _SlDeviceMsgGet_u Msg; 00401 _SlCmdExt_t CmdExt; 00402 /* verify no erorr handling in progress. if in progress than 00403 ignore the API execution and return immediately with an error */ 00404 VERIFY_NO_ERROR_HANDLING_IN_PROGRESS(); 00405 00406 if (*pConfigLen == 0) 00407 { 00408 return SL_EZEROLEN; 00409 } 00410 00411 if( pOption ) 00412 { 00413 00414 _SlDrvResetCmdExt(&CmdExt); 00415 CmdExt.RxPayloadLen = (_i16)*pConfigLen; 00416 CmdExt.pRxPayload = (_u8 *)pValues; 00417 00418 Msg.Cmd.DeviceSetId = DeviceGetId; 00419 00420 Msg.Cmd.Option = (_u16)*pOption; 00421 00422 VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlDeviceGetCmdCtrl, &Msg, &CmdExt)); 00423 00424 if( pOption ) 00425 { 00426 *pOption = (_u8)Msg.Rsp.Option; 00427 } 00428 00429 if (CmdExt.RxPayloadLen < CmdExt.ActualRxPayloadLen) 00430 { 00431 *pConfigLen = (_u8)CmdExt.RxPayloadLen; 00432 return SL_ESMALLBUF; 00433 } 00434 else 00435 { 00436 *pConfigLen = (_u8)CmdExt.ActualRxPayloadLen; 00437 } 00438 00439 return (_i16)Msg.Rsp.Status; 00440 } 00441 else 00442 { 00443 return -1; 00444 } 00445 } 00446 #endif 00447 00448 /****************************************************************************** 00449 sl_DevSet 00450 ******************************************************************************/ 00451 typedef union 00452 { 00453 _DeviceSetGet_t Cmd; 00454 _BasicResponse_t Rsp; 00455 }_SlDeviceMsgSet_u; 00456 00457 00458 00459 #if _SL_INCLUDE_FUNC(sl_DevSet) 00460 00461 static const _SlCmdCtrl_t _SlDeviceSetCmdCtrl = 00462 { 00463 SL_OPCODE_DEVICE_DEVICESET, 00464 (_SlArgSize_t)sizeof(_DeviceSetGet_t), 00465 (_SlArgSize_t)sizeof(_BasicResponse_t) 00466 }; 00467 00468 _i32 sl_DevSet(const _u8 DeviceSetId ,const _u8 Option,const _u8 ConfigLen,const _u8 *pValues) 00469 { 00470 _SlDeviceMsgSet_u Msg; 00471 _SlCmdExt_t CmdExt; 00472 00473 /* verify no erorr handling in progress. if in progress than 00474 ignore the API execution and return immediately with an error */ 00475 VERIFY_NO_ERROR_HANDLING_IN_PROGRESS(); 00476 00477 _SlDrvResetCmdExt(&CmdExt); 00478 00479 CmdExt.TxPayloadLen = (ConfigLen+3) & (~3); 00480 CmdExt.pTxPayload = (_u8 *)pValues; 00481 00482 Msg.Cmd.DeviceSetId = DeviceSetId; 00483 Msg.Cmd.ConfigLen = ConfigLen; 00484 Msg.Cmd.Option = Option; 00485 00486 VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlDeviceSetCmdCtrl, &Msg, &CmdExt)); 00487 00488 return (_i16)Msg.Rsp.status; 00489 } 00490 #endif 00491 00492 00493 /****************************************************************************** 00494 _SlDrvDeviceEventHandler - handles internally device async events 00495 ******************************************************************************/ 00496 _SlReturnVal_t _SlDrvDeviceEventHandler(void* pEventInfo) 00497 { 00498 DeviceEventInfo_t* pInfo = (DeviceEventInfo_t*)pEventInfo; 00499 _SlResponseHeader_t* pHdr = (_SlResponseHeader_t *)pInfo->pAsyncMsgBuff; 00500 _BasicResponse_t *pMsgArgs = (_BasicResponse_t *)_SL_RESP_ARGS_START(pHdr); 00501 00502 switch(pHdr->GenHeader.Opcode) 00503 { 00504 case SL_OPCODE_DEVICE_INITCOMPLETE: 00505 _sl_HandleAsync_InitComplete(pHdr); 00506 break; 00507 case SL_OPCODE_DEVICE_STOP_ASYNC_RESPONSE: 00508 _sl_HandleAsync_Stop(pHdr); 00509 break; 00510 00511 00512 case SL_OPCODE_DEVICE_ABORT: 00513 { 00514 /* release global lock of cmd context */ 00515 if (pInfo->bInCmdContext == TRUE) 00516 { 00517 SL_DRV_LOCK_GLOBAL_UNLOCK(); 00518 } 00519 00520 #ifndef SL_TINY_EXT 00521 _SlDriverHandleError(SL_DEVICE_ABORT_ERROR_EVENT, 00522 *((_u32*)pMsgArgs), /* Abort type */ 00523 *((_u32*)pMsgArgs + 1)); /* Abort data */ 00524 #endif 00525 } 00526 break; 00527 00528 case SL_OPCODE_DEVICE_ASYNC_GENERAL_ERROR: 00529 { 00530 SlDeviceEvent_t devHandler; 00531 devHandler.Event = SL_DEVICE_GENERAL_ERROR_EVENT; 00532 devHandler.EventData.deviceEvent.status = pMsgArgs->status & 0xFF; 00533 devHandler.EventData.deviceEvent.sender = (SlErrorSender_e)((pMsgArgs->status >> 8) & 0xFF); 00534 _SlDrvHandleGeneralEvents(&devHandler); 00535 } 00536 00537 break; 00538 default: 00539 SL_ERROR_TRACE2(MSG_306, "ASSERT: _SlDrvDeviceEventHandler : invalid opcode = 0x%x = %1", pHdr->GenHeader.Opcode, pHdr->GenHeader.Opcode); 00540 } 00541 00542 return SL_OS_RET_CODE_OK; 00543 } 00544 00545 00546 /****************************************************************************** 00547 sl_UartSetMode 00548 ******************************************************************************/ 00549 #ifdef SL_IF_TYPE_UART 00550 typedef union 00551 { 00552 _DevUartSetModeCommand_t Cmd; 00553 _DevUartSetModeResponse_t Rsp; 00554 }_SlUartSetModeMsg_u; 00555 00556 00557 #if _SL_INCLUDE_FUNC(sl_UartSetMode) 00558 00559 00560 const _SlCmdCtrl_t _SlUartSetModeCmdCtrl = 00561 { 00562 SL_OPCODE_DEVICE_SETUARTMODECOMMAND, 00563 (_SlArgSize_t)sizeof(_DevUartSetModeCommand_t), 00564 (_SlArgSize_t)sizeof(_DevUartSetModeResponse_t) 00565 }; 00566 00567 _i16 sl_UartSetMode(const SlUartIfParams_t* pUartParams) 00568 { 00569 _SlUartSetModeMsg_u Msg; 00570 _u32 magicCode = (_u32)0xFFFFFFFF; 00571 00572 Msg.Cmd.BaudRate = pUartParams->BaudRate; 00573 Msg.Cmd.FlowControlEnable = pUartParams->FlowControlEnable; 00574 00575 00576 VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlUartSetModeCmdCtrl, &Msg, NULL)); 00577 00578 /* cmd response OK, we can continue with the handshake */ 00579 if (SL_RET_CODE_OK == Msg.Rsp.status) 00580 { 00581 sl_IfMaskIntHdlr(); 00582 00583 /* Close the comm port */ 00584 sl_IfClose(g_pCB->FD); 00585 00586 /* Re-open the comm port */ 00587 sl_IfOpen((void * )pUartParams, UART_IF_OPEN_FLAG_RE_OPEN); 00588 00589 sl_IfUnMaskIntHdlr(); 00590 00591 /* send the magic code and wait for the response */ 00592 sl_IfWrite(g_pCB->FD, (_u8* )&magicCode, 4); 00593 00594 magicCode = UART_SET_MODE_MAGIC_CODE; 00595 sl_IfWrite(g_pCB->FD, (_u8* )&magicCode, 4); 00596 00597 /* clear magic code */ 00598 magicCode = 0; 00599 00600 /* wait (blocking) till the magic code to be returned from device */ 00601 sl_IfRead(g_pCB->FD, (_u8* )&magicCode, 4); 00602 00603 /* check for the received magic code matching */ 00604 if (UART_SET_MODE_MAGIC_CODE != magicCode) 00605 { 00606 _SL_ASSERT(0); 00607 } 00608 } 00609 00610 return (_i16)Msg.Rsp.status; 00611 } 00612 #endif 00613 #endif 00614 00615
Generated on Tue Jul 12 2022 12:06:48 by 1.7.2