Functions | |
| wwd_result_t | wwd_thread_init (void) |
| void | wwd_thread_notify_irq (void) |
| int8_t | wwd_thread_poll_all (void) |
| void | wwd_thread_quit (void) |
| int8_t | wwd_thread_receive_one_packet (void) |
| int8_t | wwd_thread_send_one_packet (void) |
| void | wwd_thread_set_tx_packet_filter (wwd_thread_filter_tx_packet_t tx_packet_callback, void *userdata) |
Allows thread safe access to the WICED WiFi Driver (WWD) hardware bus
This file provides functions which allow multiple threads to use the WWD hardware bus (SDIO or SPI) This is achieved by having a single thread (the "WWD Thread") which queues messages to be sent, sending them sequentially, as well as receiving messages as they arrive.
Messages to be sent come from the wwd_sdpcm_send_common function in wwd_sdpcm.c . The messages already contain SDPCM headers, but not any bus headers (GSPI), and are passed to the wwd_thread_send_data function. This function can be called from any thread.
Messages are received by way of a callback supplied by in SDPCM.c - wwd_sdpcm_process_rx_packet Received messages are delivered in the context of the WWD Thread, so the callback function needs to avoid blocking.
It is also possible to use these functions without any operating system, by periodically calling the wwd_thread_send_one_packet, wwd_thread_receive_one_packet or wwd_thread_poll_all functions
| wwd_result_t wwd_thread_init | ( | void | ) |
Initialises the WWD Thread
Initialises the WWD thread, and its flags/semaphores, then starts it running
| int8_t wwd_thread_poll_all | ( | void | ) |
Sends and Receives all waiting packets
Calls wwd_thread_send_one_packet and wwd_thread_receive_one_packet once to send and receive packets, until there are no more packets waiting to be transferred.
This function is normally used by the WWD Thread, but can be called periodically by systems which have no RTOS to ensure packets get send and received properly.
Note: do not loop in here, to avoid overwriting previously rx-ed packets
| void wwd_thread_quit | ( | void | ) |
Terminates the WWD Thread
Sets a flag then wakes the WWD Thread to force it to terminate.
| int8_t wwd_thread_receive_one_packet | ( | void | ) |
Receives a packet if one is waiting
Checks the wifi chip fifo to determine if there is any packets waiting to be received. If there are, then it receives the first one, and calls the callback wwd_sdpcm_process_rx_packet (in wwd_sdpcm.c).
This function is normally used by the WWD Thread, but can be called periodically by systems which have no RTOS to ensure packets get received properly.
| int8_t wwd_thread_send_one_packet | ( | void | ) |
Sends the first queued packet
Checks the queue to determine if there is any packets waiting to be sent. If there are, then it sends the first one.
This function is normally used by the WWD Thread, but can be called periodically by systems which have no RTOS to ensure packets get sent.
| void wwd_thread_set_tx_packet_filter | ( | wwd_thread_filter_tx_packet_t | tx_packet_callback, |
| void * | userdata ) |
Called by a WICED application to filter outgoing packets before they are passed to the wlan CPU.
NOTE: The packet passed to the filter callback will be processed normally when the callback returns. IMPORTANT: This functionality must be used with extreme care. The callback will be called in the context of the WWD thread which normally operates with a very small stack. And delays in processing will significantly impact network performance.
| tx_packet_callback | : Callback routine to invoke when packet is sent. |
| userdata | : Opaque data pointer to pass back to application in callback. |