[riot-notifications] [RIOT-OS/RIOT] cpu/esp: esp_now_netdev fixes and optimizations (#10700)

Sebastian Meiling notifications at github.com
Thu Jan 10 08:52:34 CET 2019

smlng requested changes on this pull request.

> -    critical_enter();
+    /*
+     * The function `esp_now_recv_cb` is executed in the context of the `wifi`
+     * thread. The ISRs handling the hardware interrupts from the WiFi
+     * interface pass events to a message queue of the `wifi` thread which is
+     * sequentially processed by the `wifi` thread to asynchronously execute
+     * callback functions such as `esp_now_recv_cb`.
+     *
+     * It should be therefore not possible to reenter function
+     * `esp_now_recv_cb`. To avoid inconsistencies this is checked by an
+     * additional boolean variable . This can not be realized by a mutex
+     * because `esp_now_recv_cb` would be reentered from same thread context.
+     * If the NDEBUG macro is undefined, an assertion is used instead for
+     * debugging purposes.
+     */
+    assert(!_in_recv_cb);

this seems redundant in light of the following `if`, or not?

+    /*
+     * Since we are not in the interrupt context, we do not have to pass
+     * `NETDEV_EVENT_ISR` first. We can call the receive function directly.
+     * But we have to unlock the mutex and enable interrupts before.

which mutex?

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190110/58f3afe2/attachment.html>

More information about the notifications mailing list