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.

LAUNCHCC3220MODASF: sl_Select() function timeout issue

Part Number: LAUNCHCC3220MODASF
Other Parts Discussed in Thread: CC3220MOD

Regarding CC3220MOD driver, We found sl_Select() timeout function does not work correctly.
 
C:\ti\simplelink_sdk_wifi_plugin_2_40_00_22\source\ti\drivers\net\wifi
sl_socket.c
static _i8 _i16 sl_Select(void)

------------------------------------------------------------
_i16 sl_Select(_i16 nfds,
SlFdSet_t *readsds,
SlFdSet_t *writesds,
SlFdSet_t *exceptsds,
struct SlTimeval_t *timeout) {

(ellipsis)
 
/* this divides by 1024 to fit the result in a int16_t.
* Upon receiving, the NWP multiply this value by 1024. */
timeout->tv_usec = (timeout->tv_usec >> 10); <------ (A)
 
if(0xffff <= timeout->tv_usec)
{
Msg.Cmd.tv_usec = 0xffff;
}
else
{
Msg.Cmd.tv_usec = (_u16)timeout->tv_usec;
}

(ellipsis)


 
ret = _SlDrvRegisterForSelectAsync(&SelectParams, &Msg, timeout,
SelectInProgress);


(ellipsis)

}
--------------------------------------------------------------
 
At the <-----(A) point, 10bit right shift is executed for "timeout" itself.

This will affect to the following <------(B) point in _SlDrvRegisterForSelectAsync()  functioon, 
 
--------------------------------------------------------------
static _i16 _SlDrvRegisterForSelectAsync(_SlSelectEntry_t* pEntry,
_SlSelectMsg_u* pMsg,
struct SlTimeval_t *timeout,
_u8 SelectInProgress) {
(ellipsis)

if((pMsg->Cmd.tv_sec != 0xFFFF) && (timeout != NULL))
{
pEntry->TimeStamp = to_mSec(timeout); <------(B)
}
else
{
pEntry->TimeStamp = SELECT_NO_TIMEOUT;
}

(ellipsis)
}
 
static __INLINE _u32 to_mSec(struct SlTimeval_t* timeout) {
return (((slcb_GetTimestamp() /
SL_TIMESTAMP_TICKS_IN_10_MILLISECONDS) *
10) + (timeout->tv_sec * 1000) + (timeout->tv_usec / 1000)); <------(B) }
---------------------------------------------------------------
 
Because timeout -> tv_usec was 10 bit shifted already, TOT will be set as almost 0msec if TOT is less than 1sec.

If we did not modify "timeout" itself at  <------(A) , but change like as sg.Cmd.tv_usec = (_u16)(timeout->tv_usec >> 10);

Then it seems the function seems to work well.

Please review these changes.

Regards, A.Fujinaka