Other Parts Discussed in Thread: CC3200SDK, CC3200
Hello, I'm using CC3200SDK_1.5.0 to build a wireless storage device and the framework is FreeRTOS(in osi.h)
I've combined 3 examples, p2p, http server and file_operations. Each of them is separated to a task.
p2p and http collaborated together well, but it stucks when file_operation is added.
The idea is that whenever httpServerCallback() receive a special token, it signal file_operation task to do some file creation, write/read.
However, it can even jump out of sl_FsOpen() function. After using debug mode, I found 2 clues.
1. It stuck in a call stack like below after executing sl_FsOpen().
2. After tracing the calls step by step, I've observed that sl_FsOpen() seemd to wait for something for synchronization(xSemephoreTake() like functions)
Do I need to do other initialization to perform file operations ?
My code:
// code related to this question in http server void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *pSlHttpServerEvent, SlHttpServerResponse_t *pSlHttpServerResponse) { unsigned char strLenVal = 0; int i; if(!pSlHttpServerEvent || !pSlHttpServerResponse) { return; } switch (pSlHttpServerEvent->Event) { case SL_NETAPP_HTTPPOSTTOKENVALUE_EVENT: { unsigned char *ptrName = pSlHttpServerEvent->EventData.httpPostData.token_name.data; long lenName = pSlHttpServerEvent->EventData.httpPostData.token_name.len; unsigned char *ptrValue = pSlHttpServerEvent->EventData.httpPostData.token_value.data; long lenValue = pSlHttpServerEvent->EventData.httpPostData.token_value.len; if(IS_TOKEN_MATCH(ptrName, PUSH_START_TOKEN)){ // push starts // atomic osi_LockObjLock(&pushLock, OSI_WAIT_FOREVER); memcpy(pushMsg.msg, ptrValue, lenValue); (pushMsg.msg)[lenValue] = '\0'; pushMsg.msgLen = lenValue; pushMsg.op = STORAGE_OP_OPEN_WRITE; osi_LockObjUnlock(&pushLock); // atomic osi_SyncObjSignalFromISR(&pushSync); } } break; default: break; } } // code related to file operation task while(osi_SyncObjWait(pMsg->pSync, OSI_WAIT_FOREVER) == OSI_OK){ osi_LockObjLock(pMsg->pLock, OSI_WAIT_FOREVER); lRetVal = 0; switch (pMsg->op) { case STORAGE_OP_OPEN_WRITE: lRetVal = appCreateFile(pMsg); break; default: break; } if(lRetVal < 0){ ERR_PRINT(lRetVal); } osi_LockObjUnlock(pMsg->pLock); }
I'm sure the locking, synchronization part is correct since I have tested the code by removing the sl_Fsxxx() functions and it works well !
Does anyone have a clue on this issue? I appreciate anyone's opinion !