TI's CC3100. A test demo with very little testing done!
Revision 2:b3fd5b3d9860, committed 2015-02-15
- Comitter:
- dflet
- Date:
- Sun Feb 15 11:01:37 2015 +0000
- Parent:
- 1:c73566c6788a
- Child:
- 3:b89198ac2efe
- Commit message:
- Removed more debug comments, defined sl_Free & sl_Malloc. Also remove some duplicate #defines
Changed in this revision
--- a/simplelink/cc3100.cpp Tue Feb 10 12:58:16 2015 +0000
+++ b/simplelink/cc3100.cpp Sun Feb 15 11:01:37 2015 +0000
@@ -45,7 +45,7 @@
#include "cc3100.h"
#include "fPtr_func.h"
-//#include "GetSNTPTime.h"
+
namespace mbed_cc3100 {
@@ -751,7 +751,7 @@
*/
int32_t cc3100::establishConnectionWithAP()
{
- //printf(" cc3100::establishConnectionWithAP \n\r");
+
SlSecParams_t secParams = {0};
int32_t retVal = 0;
--- 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 {
--- a/simplelink/cc3100_netapp.cpp Tue Feb 10 12:58:16 2015 +0000
+++ b/simplelink/cc3100_netapp.cpp Sun Feb 15 11:01:37 2015 +0000
@@ -46,18 +46,18 @@
#include "cc3100_netapp.h"
#include "fPtr_func.h"
+namespace mbed_cc3100 {
+
/*****************************************************************************/
/* Macro declarations */
/*****************************************************************************/
-#define NETAPP_MDNS_OPTIONS_ADD_SERVICE_BIT ((uint32_t)0x1 << 31)
+const uint32_t NETAPP_MDNS_OPTIONS_ADD_SERVICE_BIT = ((uint32_t)0x1 << 31);
#ifdef SL_TINY
-#define NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH 63
+const uint8_t NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH = 63;
#else
-#define NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH 255
+const uint8_t NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH = 255;
#endif
-
-namespace mbed_cc3100 {
cc3100_netapp::cc3100_netapp(cc3100_driver &driver, cc3100_nonos &nonos)
: _driver(driver), _nonos(nonos)
--- a/simplelink/cc3100_nonos.cpp Tue Feb 10 12:58:16 2015 +0000
+++ b/simplelink/cc3100_nonos.cpp Sun Feb 15 11:01:37 2015 +0000
@@ -195,7 +195,6 @@
_SlNonOsRetVal_t cc3100_nonos::sl_SyncObjWait(_SlNonOsSemObj_t* pSyncObj, _SlNonOsSemObj_t WaitValue, _SlNonOsSemObj_t SetValue, _SlNonOsTime_t Timeout){//_SlNonOsSemGet(pSyncObj,NON_OS_SYNC_OBJ_SIGNAL_VALUE,NON_OS_SYNC_OBJ_CLEAR_VALUE,Timeout)
-//printf("_SlNonOsSemGet\r\n");
while (Timeout > 0) {
if (WaitValue == *pSyncObj) {
*pSyncObj = SetValue;
--- a/simplelink/cc3100_user.h Tue Feb 10 12:58:16 2015 +0000
+++ b/simplelink/cc3100_user.h Sun Feb 15 11:01:37 2015 +0000
@@ -652,7 +652,7 @@
\warning
*/
-#define sl_Malloc(Size)
+#define sl_Malloc(Size) malloc(Size)
/*!
\brief
@@ -663,7 +663,7 @@
\warning
*/
-#define sl_Free(pMem)
+#define sl_Free(pMem) free(pMem)
#endif
@@ -712,7 +712,7 @@
\note belongs to \ref porting_sec
\warning
*/
-#define SL_OS_RET_CODE_OK
+//#define SL_OS_RET_CODE_OK
/*!
\brief
@@ -720,7 +720,7 @@
\note belongs to \ref porting_sec
\warning
*/
-#define SL_OS_WAIT_FOREVER
+//#define SL_OS_WAIT_FOREVER
/*!
\brief
@@ -728,7 +728,7 @@
\note belongs to \ref porting_sec
\warning
*/
-#define SL_OS_NO_WAIT
+//#define SL_OS_NO_WAIT
/*!
\brief type definition for a time value
@@ -737,7 +737,7 @@
\note belongs to \ref porting_sec
*/
-#define _SlTime_t
+//#define _SlTime_t
/*!
\brief type definition for a sync object container
@@ -752,7 +752,7 @@
\note belongs to \ref porting_sec
*/
-#define _SlSyncObj_t
+//#define _SlSyncObj_t
/*!
@@ -769,7 +769,7 @@
\note belongs to \ref porting_sec
\warning
*/
-#define sl_SyncObjCreate(pSyncObj,pName)
+//#define sl_SyncObjCreate(pSyncObj,pName)
/*!
@@ -782,7 +782,7 @@
\note belongs to \ref porting_sec
\warning
*/
-#define sl_SyncObjDelete(pSyncObj)
+//#define sl_SyncObjDelete(pSyncObj)
/*!
@@ -797,7 +797,7 @@
\note the function could be called from ISR context
\warning
*/
-#define sl_SyncObjSignal(pSyncObj)
+//#define sl_SyncObjSignal(pSyncObj)
/*!
\brief This function generates a sync signal for the object from Interrupt
@@ -811,7 +811,7 @@
\note the function could be called from ISR context
\warning
*/
-#define sl_SyncObjSignalFromIRQ(pSyncObj)
+//#define sl_SyncObjSignalFromIRQ(pSyncObj)
/*!
\brief This function waits for a sync signal of the specific sync object
@@ -827,7 +827,7 @@
\note belongs to \ref porting_sec
\warning
*/
-#define sl_SyncObjWait(pSyncObj,Timeout)
+//#define sl_SyncObjWait(pSyncObj,Timeout)
/*!
\brief type definition for a locking object container
@@ -839,7 +839,7 @@
\note On each porting or platform the type could be whatever is needed - integer, structure etc.
\note belongs to \ref porting_sec
*/
-#define _SlLockObj_t
+//#define _SlLockObj_t
/*!
\brief This function creates a locking object.