where is the semaphore setted in app wwd.canned_send from WICED 3.1.2 ?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

The function host_rtos_get_semaphore from line 118~line 168 of the file(/Wiced-SDK/WICED/RTOS/NoOS/WWD/wwd_rtos.c) in app wwd.canned_send from WICED SDK3.1.2 as following:

/**

* Would normally get a semaphore    

* Since there is only one thread, this function calls the @ref wwd_thread_poll_all to cause Wiced to

* repeatedly poll and process the Transmit and receive queues, until the given semaphore is

* set by a function within the transmit/receive processing. Once the set semaphore has been seen,

* it is decremented back to zero and the function returns to simulate a resuming thread

* Timeout is ignored in this function.

*

* Must not be called from interrupt context.

*

* @param semaphore : Pointer to variable which will receive handle of created semaphore

* @param timeout_ms : unsupported - Maximum period to block for. Can be passed NEVER_TIMEOUT to request no timeout

* @param will_set_in_isr : True if the semaphore will be set in an ISR. Currently only used for NoOS/NoNS

*

* @return wwd_result_t : WWD_SUCCESS if semaphore was successfully acquired

*                     : WICED_TIMEOUT if semaphore was not acquired before timeout_ms period

*/

wwd_result_t host_rtos_get_semaphore( host_semaphore_type_t* semaphore, uint32_t timeout_ms, wiced_bool_t will_set_in_isr )

{

...

}

As mentioned above:

Since there is only one thread, this function calls the @ref wwd_thread_poll_all to cause Wiced to

* repeatedly poll and process the Transmit and receive queues, until the given semaphore is

* set by a function within the transmit/receive processing.

I want to know that the parameter semaphore of the funtion is set by which function within the transmit/receive processing? Which line is the semaphore setted at?  The semaphore can NOT get  which at line 640 in the function wwd_result_t wwd_wifi_join from file "/Wiced-SDK/WICED/WWD/internal/wwd_wifi.c" as following:


result = host_rtos_get_semaphore( &join_sema, DEFAULT_JOIN_TIMEOUT, WICED_FALSE );


thanks a lot.

0 Likes
2 Replies
MudeL_51
Employee
Employee
10 replies posted 5 replies posted First solution authored

These semaphore Get/Set APIs are only used by any procedure related with the WIFI.

In the API "host_rtos_get_semaphore()", you can find it calls the function "wwd_thread_poll_all( )".

In the function "wwd_thread_poll_all( )", it will send/receive packet to/from WIFI chip, when sent/received packet, it will set the semaphore as need.

It is more complicated procedure.

You just need to image that in the get semaphore function, it still loop to do something that will make the semaphore to be set.

0 Likes
Anonymous
Not applicable

Thanks a lot.

0 Likes