cc3100_Socket_Wifi_Server with Ethernet Interface not working
Dependencies: EthernetInterface mbed-rtos mbed
Fork of cc3100_Test_Demo by
Diff: simplelink/cc3100_driver.cpp
- Revision:
- 2:b3fd5b3d9860
- Parent:
- 0:e89ba455dbcf
diff -r c73566c6788a -r b3fd5b3d9860 simplelink/cc3100_driver.cpp --- a/simplelink/cc3100_driver.cpp Tue Feb 10 12:58:16 2015 +0000 +++ b/simplelink/cc3100_driver.cpp Sun Feb 15 11:01:37 2015 +0000 @@ -150,9 +150,7 @@ _flowcont._SlDrvFlowContDeinit(); OSI_RET_OK_CHECK( _nonos.sl_SyncObjDelete(&g_pCB->CmdSyncObj, 0) ); - OSI_RET_OK_CHECK( _nonos.sl_LockObjDelete(&g_pCB->GlobalLockObj, 0) ); - OSI_RET_OK_CHECK( _nonos.sl_LockObjDelete(&g_pCB->ProtectionLockObj, 0) ); for (Idx = 0; Idx < MAX_CONCURRENT_ACTIONS; Idx++) { OSI_RET_OK_CHECK( _nonos.sl_SyncObjDelete(&g_pCB->ObjPool[Idx].SyncObj, 0) ); @@ -197,7 +195,7 @@ 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)); g_pCB->IsCmdRespWaited = TRUE; - //SL_TRACE0(DBG_MSG, MSG_312, "_SlDrvCmdOp: call _SlDrvMsgWrite"); + SL_TRACE0(DBG_MSG, MSG_312, "_SlDrvCmdOp: call _SlDrvMsgWrite"); /* send the message */ g_pCB->FunctionParams.pCmdCtrl = pCmdCtrl; g_pCB->FunctionParams.pTxRxDescBuff = (uint8_t*)pTxRxDescBuff; @@ -217,7 +215,7 @@ /* wait for respond */ RetVal = _SlDrvMsgReadCmdCtx(); /* will free global lock */ - //SL_TRACE0(DBG_MSG, MSG_314, "_SlDrvCmdOp: exited _SlDrvMsgReadCmdCtx"); + SL_TRACE0(DBG_MSG, MSG_314, "_SlDrvCmdOp: exited _SlDrvMsgReadCmdCtx"); } else { OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE)); @@ -330,7 +328,6 @@ /* ******************************************************************************/ _SlReturnVal_t cc3100_driver::_SlDrvDataWriteOp(_SlSd_t Sd, _SlCmdCtrl_t *pCmdCtrl, void* pTxRxDescBuff, _SlCmdExt_t *pCmdExt) { - printf("Debug _SlDrvDataWriteOp\r\n"); _SlReturnVal_t RetVal = SL_EAGAIN; /* initiated as SL_EAGAIN for the non blocking mode */ while( 1 ) { /* Do Flow Control check/update for DataWrite operation */ @@ -344,7 +341,7 @@ OSI_RET_OK_CHECK( _nonos.sl_LockObjUnlock(&g_pCB->FlowContCB.TxLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE) ); return SL_SOC_ERROR; } - //printf("Debug _SlDrvDataWriteOp 3\r\n"); + if(g_pCB->FlowContCB.TxPoolCnt <= FLOW_CONT_MIN + 1) { /* we have indication that this socket is set as blocking and we try to */ /* unblock it - return an error */ @@ -373,7 +370,6 @@ /* send the message */ g_pCB->TempProtocolHeader.Opcode = pCmdCtrl->Opcode; g_pCB->TempProtocolHeader.Len = _SL_PROTOCOL_CALC_LEN(pCmdCtrl,pCmdExt); - g_pCB->FunctionParams.pCmdCtrl = pCmdCtrl; g_pCB->FunctionParams.pTxRxDescBuff = (unsigned char*)pTxRxDescBuff; g_pCB->FunctionParams.pCmdExt = pCmdExt; @@ -695,7 +691,6 @@ case SL_OPCODE_WLAN_P2P_NEG_REQ_RECEIVED: { slPeerInfoAsyncResponse_t* pResp = (slPeerInfoAsyncResponse_t*)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf); - wlanEvent.Event = SL_WLAN_P2P_NEG_REQ_RECEIVED_EVENT; memcpy(wlanEvent.EventData.P2PModeNegReqReceived.mac,pResp->mac, 6); memcpy(wlanEvent.EventData.P2PModeNegReqReceived.go_peer_device_name,pResp->go_peer_device_name,pResp->go_peer_device_name_len); @@ -707,10 +702,8 @@ } case SL_OPCODE_WLAN_CONNECTION_FAILED: { slWlanConnFailureAsyncResponse_t* pResp = (slWlanConnFailureAsyncResponse_t*)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf); - wlanEvent.Event = SL_WLAN_CONNECTION_FAILED_EVENT; wlanEvent.EventData.P2PModewlanConnectionFailure.status = pResp->status; - g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&wlanEvent); break; @@ -726,7 +719,6 @@ memcpy(wlanEvent.EventData.STAandP2PModeWlanConnected.ssid_name, pWlanResp->ssid_name, pWlanResp->ssid_len); wlanEvent.EventData.STAandP2PModeWlanConnected.ssid_len = pWlanResp->ssid_len; wlanEvent.EventData.STAandP2PModeWlanConnected.go_peer_device_name_len = pWlanResp->go_peer_device_name_len; - g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&wlanEvent); break; @@ -771,7 +763,6 @@ netAppEvent.EventData.ipLeased.ip_address = pIpV4->ip_address; netAppEvent.EventData.ipLeased.lease_time = pIpV4->lease_time; memcpy(netAppEvent.EventData.ipLeased.mac, pIpV4->mac, 6); - g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&netAppEvent); } break; @@ -782,7 +773,6 @@ netAppEvent.EventData.ipReleased.ip_address = pIpV4->ip_address; netAppEvent.EventData.ipReleased.reason = pIpV4->reason; memcpy(netAppEvent.EventData.ipReleased.mac, pIpV4->mac, 6); - g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&netAppEvent); } break; @@ -814,7 +804,6 @@ wlanEvent.EventData.smartConfigStartResponse.status = pResp->status; wlanEvent.EventData.smartConfigStartResponse.ssid_len = pResp->ssid_len; wlanEvent.EventData.smartConfigStartResponse.private_token_len = pResp->private_token_len; - memset(wlanEvent.EventData.smartConfigStartResponse.ssid, 0x00, sizeof(wlanEvent.EventData.smartConfigStartResponse.ssid)); memcpy(wlanEvent.EventData.smartConfigStartResponse.ssid, pResp->ssid, pResp->ssid_len); /* if private data exist */ @@ -829,10 +818,8 @@ case SL_OPCODE_WLAN_SMART_CONFIG_STOP_ASYNC_RESPONSE: { slSmartConfigStopAsyncResponse_t *pResp = (slSmartConfigStopAsyncResponse_t*)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf); - wlanEvent.Event = SL_WLAN_SMART_CONFIG_STOP_EVENT; wlanEvent.EventData.smartConfigStopResponse.status = pResp->status; - g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&wlanEvent); } @@ -845,7 +832,6 @@ memcpy(wlanEvent.EventData.APModeStaConnected.mac,pResp->mac, 6); memcpy(wlanEvent.EventData.APModeStaConnected.go_peer_device_name,pResp->go_peer_device_name,pResp->go_peer_device_name_len); wlanEvent.EventData.APModeStaConnected.go_peer_device_name_len = pResp->go_peer_device_name_len; - memcpy(wlanEvent.EventData.APModeStaConnected.own_ssid,pResp->own_ssid,pResp->own_ssid_len); wlanEvent.EventData.APModeStaConnected.own_ssid_len = pResp->own_ssid_len; g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&wlanEvent); @@ -895,10 +881,8 @@ if(_SL_PENDING_RX_MSG(g_pCB)) { - g_pCB->FunctionParams.AsyncExt.pAsyncBuf = NULL;/* buffer must be allocated by _SlDrvMsgRead */ - - g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler = NULL; - + g_pCB->FunctionParams.AsyncExt.pAsyncBuf = NULL;/* buffer must be allocated by _SlDrvMsgRead */ + g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler = NULL; g_pCB->FunctionParams.AsyncExt.RxMsgClass = (_SlRxMsgClass_e)(-1);/* init to illegal value and verify it's overwritten with the valid one */ VERIFY_RET_OK(_SlDrvMsgRead()); @@ -1065,8 +1049,7 @@ /* { */ /* } */ else { - //SL_ERROR_TRACE2(MSG_311, "ASSERT: _SlDrvClassifyRxMsg : invalid opcode = 0x%x = %i", Opcode, Opcode); - printf("ASSERT: _SlDrvClassifyRxMsg : invalid opcode = 0x%x = %i", Opcode, Opcode); + SL_ERROR_TRACE2(MSG_311, "ASSERT: _SlDrvClassifyRxMsg : invalid opcode = 0x%x = %i", Opcode, Opcode); } } } else {