TI's CC3100. A test demo with very little testing done!
Fork of cc3100_Test_Demo2 by
Diff: simplelink/G_functions/fPtr_func.cpp
- Revision:
- 7:0687d16b9781
- Parent:
- 5:d3b320ebd469
--- a/simplelink/G_functions/fPtr_func.cpp Thu Mar 19 15:39:08 2015 +0000 +++ b/simplelink/G_functions/fPtr_func.cpp Thu Sep 03 13:43:50 2015 +0000 @@ -43,9 +43,6 @@ using namespace mbed_cc3100; -cc3100_driver *_driver; -cc3100_nonos *_nonos; -cc3100_netapp *_netapp; cc3100 *_cc3100_; #ifdef __cplusplus @@ -372,15 +369,15 @@ { _SocketAddrResponse_u *pMsgArgs = (_SocketAddrResponse_u *)_SL_RESP_ARGS_START(pVoidBuf); - _driver->_SlDrvProtectionObjLockWaitForever(); + _cc3100_->_driver._SlDrvProtectionObjLockWaitForever(); VERIFY_PROTOCOL(( pMsgArgs->IpV4.sd & BSD_SOCKET_ID_MASK) <= SL_MAX_SOCKETS); VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs); memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs,sizeof(_SocketAddrResponse_u)); - _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); + _cc3100_->_driver._SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); - _driver->_SlDrvProtectionObjUnLock(); + _cc3100_->_driver._SlDrvProtectionObjUnLock(); return; } @@ -391,7 +388,7 @@ { _SocketResponse_t *pMsgArgs = (_SocketResponse_t *)_SL_RESP_ARGS_START(pVoidBuf); - _driver->_SlDrvProtectionObjLockWaitForever(); + _cc3100_->_driver._SlDrvProtectionObjLockWaitForever(); VERIFY_PROTOCOL((pMsgArgs->sd & BSD_SOCKET_ID_MASK) <= SL_MAX_SOCKETS); VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs); @@ -399,8 +396,8 @@ ((_SocketResponse_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->sd = pMsgArgs->sd; ((_SocketResponse_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->statusOrLen = pMsgArgs->statusOrLen; - _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); - _driver->_SlDrvProtectionObjUnLock(); + _cc3100_->_driver._SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); + _cc3100_->_driver._SlDrvProtectionObjUnLock(); return; } @@ -411,14 +408,14 @@ { _SelectAsyncResponse_t *pMsgArgs = (_SelectAsyncResponse_t *)_SL_RESP_ARGS_START(pVoidBuf); - _driver->_SlDrvProtectionObjLockWaitForever(); + _cc3100_->_driver._SlDrvProtectionObjLockWaitForever(); VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs); memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_SelectAsyncResponse_t)); - _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); - _driver->_SlDrvProtectionObjUnLock(); + _cc3100_->_driver._SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); + _cc3100_->_driver._SlDrvProtectionObjUnLock(); return; } @@ -432,7 +429,7 @@ { _GetHostByNameIPv4AsyncResponse_t *pMsgArgs = (_GetHostByNameIPv4AsyncResponse_t *)_SL_RESP_ARGS_START(pVoidBuf); - _driver->_SlDrvProtectionObjLockWaitForever(); + _cc3100_->_driver._SlDrvProtectionObjLockWaitForever(); VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs); @@ -446,8 +443,8 @@ memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_GetHostByNameIPv4AsyncResponse_t)); } - _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); - _driver->_SlDrvProtectionObjUnLock(); + _cc3100_->_driver._SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); + _cc3100_->_driver._SlDrvProtectionObjUnLock(); return; } @@ -563,7 +560,7 @@ /**************************************************************************************************/ - _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); + _cc3100_->_driver._SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); return; } } @@ -579,18 +576,18 @@ SlPingReport_t pingReport; if(pPingCallBackFunc) { - _netapp->CopyPingResultsToReport(pMsgArgs,&pingReport); + _cc3100_->_netapp.CopyPingResultsToReport(pMsgArgs,&pingReport); pPingCallBackFunc(&pingReport); } else { - _driver->_SlDrvProtectionObjLockWaitForever(); + _cc3100_->_driver._SlDrvProtectionObjLockWaitForever(); VERIFY_SOCKET_CB(NULL != g_pCB->PingCB.PingAsync.pAsyncRsp); if (NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs) { memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_PingReportResponse_t)); - _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); + _cc3100_->_driver._SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); } - _driver->_SlDrvProtectionObjUnLock(); + _cc3100_->_driver._SlDrvProtectionObjUnLock(); } return; } @@ -618,7 +615,7 @@ #else - OSI_RET_OK_CHECK(_nonos->sl_LockObjLock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER) ); + OSI_RET_OK_CHECK(_cc3100_->_nonos.sl_LockObjLock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER) ); #endif @@ -628,12 +625,12 @@ /* Messages might have been read by CmdResp context. Therefore after */ /* getting LockObj, check again where the Pending Rx Msg is still present. */ - if(FALSE == (_driver->_SL_PENDING_RX_MSG(g_pCB))) { - OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE)); + if(FALSE == (_cc3100_->_driver._SL_PENDING_RX_MSG(g_pCB))) { + OSI_RET_OK_CHECK(_cc3100_->_nonos.sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE)); return SL_RET_CODE_OK; } - VERIFY_RET_OK(_driver->_SlDrvMsgRead()); + VERIFY_RET_OK(_cc3100_->_driver._SlDrvMsgRead()); g_pCB->RxDoneCnt++; @@ -643,7 +640,7 @@ /* to be read */ VERIFY_PROTOCOL(NULL != g_pCB->FunctionParams.AsyncExt.pAsyncBuf); - _driver->_SlAsyncEventGenericHandler(); + _cc3100_->_driver._SlAsyncEventGenericHandler(); #if (SL_MEMORY_MGMT == SL_MEMORY_MGMT_STATIC) g_pCB->FunctionParams.AsyncExt.pAsyncBuf = NULL; @@ -662,7 +659,7 @@ VERIFY_PROTOCOL(0); } - OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE)); + OSI_RET_OK_CHECK(_cc3100_->_nonos.sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE)); return(SL_RET_CODE_OK); @@ -678,11 +675,11 @@ VERIFY_SOCKET_CB(NULL != g_pCB->StopCB.pAsyncRsp); - _driver->_SlDrvProtectionObjLockWaitForever(); + _cc3100_->_driver._SlDrvProtectionObjLockWaitForever(); memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_BasicResponse_t)); - _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); - _driver->_SlDrvProtectionObjUnLock(); + _cc3100_->_driver._SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); + _cc3100_->_driver._SlDrvProtectionObjUnLock(); return; } @@ -787,7 +784,7 @@ Token_value.token_value = httpServerResponse.ResponseData.token_value.data; - _netapp->sl_NetAppSendTokenValue(&Token_value); + _cc3100_->_netapp.sl_NetAppSendTokenValue(&Token_value); #endif } break;