This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I'm porting cc3100 for stm32f4 and don't understand the functionnement, in _SlDrvSyncObjWaitForever call during sl_Start function, of :
_SlNonOsRetVal_t _SlNonOsSemGet(_SlNonOsSemObj_t* pSyncObj, _SlNonOsSemObj_t WaitValue, _SlNonOsSemObj_t SetValue, _SlNonOsTime_t Timeout)
{
#ifdef _SlSyncWaitLoopCallback
_SlNonOsTime_t timeOutRequest = Timeout;
#endif
while (Timeout>0)
{
if (WaitValue == *pSyncObj)
{
*pSyncObj = SetValue;
break;
}
if (Timeout != NONOS_WAIT_FOREVER)
{
Timeout--;
}
_SlNonOsMainLoopTask();
#ifdef _SlSyncWaitLoopCallback
if( (__NON_OS_SYNC_OBJ_SIGNAL_VALUE == WaitValue) && (timeOutRequest != NONOS_NO_WAIT) )
{
if (WaitValue == *pSyncObj)
{
*pSyncObj = SetValue;
break;
}
_SlSyncWaitLoopCallback();
}
#endif
}
if (0 == Timeout)
{
return NONOS_RET_ERR;
}
else
{
return NONOS_RET_OK;
}
}
Timeout and NONOS_WAIT_FOREVER is define by 255 so the function loop infinitly.
So my question is why? =)
Hi Dupont,
sl_Start() will wait forever for the init sequence to complete, unless a callback is specified in the parameter list.
-Aaron
I don't see or understand, in function " _SlNonOsSemGet ", where *psyncObj is update :
if (WaitValue == *pSyncObj)
{
*pSyncObj = SetValue;
break;
}
Because now i always have a " NONOS_RET_ERR "
if (0 == Timeout)
{
return NONOS_RET_ERR;
}
else
{
return NONOS_RET_OK;
}
And if the return value is NONOS_RET_ERR, the code go in infinite loop. So that's my problem.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
_SlNonOsRetVal_t _SlNonOsSemGet(_SlNonOsSemObj_t* pSyncObj, _SlNonOsSemObj_t WaitValue, _SlNonOsSemObj_t SetValue, _SlNonOsTime_t Timeout)
{
/*#ifdef _SlSyncWaitLoopCallback
_SlNonOsTime_t timeOutRequest = Timeout;
#endif*/
while (Timeout>0)
{
if (WaitValue == *pSyncObj)
{
*pSyncObj = SetValue;
break;
}
if (Timeout != 256)
{
Timeout--;
}
_SlNonOsMainLoopTask();
/*#ifdef _SlSyncWaitLoopCallback
if( (__NON_OS_SYNC_OBJ_SIGNAL_VALUE == WaitValue) && (timeOutRequest != NONOS_NO_WAIT) )
{
if (WaitValue == *pSyncObj)
{
*pSyncObj = SetValue;
break;
}
_SlSyncWaitLoopCallback();
}
#endif*/
}
if (0 == Timeout)
{
return NONOS_RET_ERR;
}
else
{
return NONOS_RET_OK;
}
}
Hi Aaron,
in my user.h file, i define :
#define sl_IfRegIntHdlr(InterruptHdl , pValue) EXTI15_10_IRQHandler(InterruptHdl , pValue)
and in my porting file, i define :
void EXTI15_10_IRQHandler(P_EVENT_HANDLER InterruptHdl , void* pValue){
int etat,i;
if (EXTI_GetITStatus(EXTI_Line12) != RESET){
pIrqEvtHdlr = InterruptHdl;
EXTI_ClearFlag(EXTI_Line12);
}
}
Because in the SDK, the function do :
int registerInterruptHandler(P_EVENT_HANDLER InterruptHdl , void* pValue)
{
pIraEventHandler = InterruptHdl;
return 0;
}
I'm wrong?
Thanks
Hi Aaron,
So i change the declaration by :
in user.h :
#define sl_IfRegIntHdlr(InterruptHdl , pValue) registerInterruptHandler(InterruptHdl , pValue)
and in my porting file :
int registerInterruptHandler(P_EVENT_HANDLER InterruptHdl , void* pValue){
pIraEventHandler = InterruptHdl;
return 0;
}
But Now, my code stuck as soon as the irq signal go high.