|
ESPHome 2026.3.0
|
Go to the source code of this file.
Enumerations | |
| enum | { ESPHOME_LWIP_SOCK_RCVEVENT_OFFSET = 8 } |
Functions | |
| void | esphome_lwip_fast_select_init (void) |
| Initialize fast select — must be called from the main loop task during setup(). | |
| struct lwip_sock * | esphome_lwip_get_sock (int fd) |
| Look up a LwIP socket struct from a file descriptor. | |
| void | esphome_lwip_hook_socket (struct lwip_sock *sock) |
| Hook a socket's netconn callback to notify the main loop task on receive events. | |
| void | esphome_lwip_wake_main_loop (void) |
| Wake the main loop task from another FreeRTOS task — costs <1 us. | |
| void | esphome_lwip_wake_main_loop_from_isr (int *px_higher_priority_task_woken) |
| Wake the main loop task from an ISR — costs <1 us. | |
| bool | esphome_lwip_set_nodelay (struct lwip_sock *sock, bool enable) |
| Set or clear TCP_NODELAY on a socket's tcp_pcb directly. | |
| void | esphome_lwip_wake_main_loop_any_context (void) |
| Wake the main loop task from any context (ISR, thread, or main loop). | |
| anonymous enum |
| Enumerator | |
|---|---|
| ESPHOME_LWIP_SOCK_RCVEVENT_OFFSET | |
Definition at line 17 of file lwip_fast_select.h.
| void esphome_lwip_fast_select_init | ( | void | ) |
Initialize fast select — must be called from the main loop task during setup().
Saves the current task handle for xTaskNotifyGive() wake notifications.
Definition at line 187 of file lwip_fast_select.c.
| struct lwip_sock * esphome_lwip_get_sock | ( | int | fd | ) |
Look up a LwIP socket struct from a file descriptor.
Returns NULL if fd is invalid or the socket/netconn is not initialized. Use this at registration time to cache the pointer for esphome_lwip_socket_has_data().
Definition at line 204 of file lwip_fast_select.c.
| void esphome_lwip_hook_socket | ( | struct lwip_sock * | sock | ) |
Hook a socket's netconn callback to notify the main loop task on receive events.
Wraps the original event_callback with one that also calls xTaskNotifyGive(). Must be called from the main loop after socket creation. The sock pointer must have been obtained from esphome_lwip_get_sock().
Definition at line 208 of file lwip_fast_select.c.
| bool esphome_lwip_set_nodelay | ( | struct lwip_sock * | sock, |
| bool | enable ) |
Set or clear TCP_NODELAY on a socket's tcp_pcb directly.
Must be called with the TCPIP core lock held (LwIPLock in C++). This bypasses lwip_setsockopt() overhead (socket lookups, switch cascade, hooks, refcounting) — just a direct pcb->flags bit set/clear. Returns true if successful, false if sock/conn/pcb is NULL or the socket is not TCP.
Definition at line 220 of file lwip_fast_select.c.
| void esphome_lwip_wake_main_loop | ( | void | ) |
Wake the main loop task from another FreeRTOS task — costs <1 us.
NOT ISR-safe — must only be called from task context.
Definition at line 236 of file lwip_fast_select.c.
| void esphome_lwip_wake_main_loop_any_context | ( | void | ) |
Wake the main loop task from any context (ISR, thread, or main loop).
ESP32-only: uses xPortInIsrContext() to detect ISR context. LibreTiny lacks IRAM_ATTR support needed for ISR-safe paths.
Definition at line 255 of file lwip_fast_select.c.
| void esphome_lwip_wake_main_loop_from_isr | ( | int * | px_higher_priority_task_woken | ) |
Wake the main loop task from an ISR — costs <1 us.
ISR-safe variant using vTaskNotifyGiveFromISR().
| px_higher_priority_task_woken | Set to pdTRUE if a context switch is needed. |
Definition at line 244 of file lwip_fast_select.c.