1 /*
2  * Copyright (c) 2022 Raspberry Pi (Trading) Ltd.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef _PICO_LWIP_FREERTOS_H
8 #define _PICO_LWIP_FREERTOS_H
9 
10 #include "pico.h"
11 #include "pico/async_context.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 /** \file pico/lwip_freertos.h
18 * \defgroup pico_lwip_freertos pico_lwip_freertos
19 * \ingroup pico_lwip
20 * \brief Glue library for integration lwIP in \c NO_SYS=0 mode with the SDK
21 *
22 * Simple \c init and \c deinit are all that is required to hook up lwIP (with full blocking API support) via an \ref async_context instance
23 */
24 
25 /*! \brief Initializes lwIP (NO_SYS=0 mode) support support for FreeRTOS using the provided async_context
26  *  \ingroup pico_lwip_freertos
27  *
28  * If the initialization succeeds, \ref lwip_freertos_deinit() can be called to shutdown lwIP support
29  *
30  * \param context the async_context instance that provides the abstraction for handling asynchronous work. Note in general
31  * this would be an \ref async_context_freertos instance, though it doesn't have to be.
32  *
33  * \return true if the initialization succeeded
34 */
35 bool lwip_freertos_init(async_context_t *context);
36 
37 /*! \brief De-initialize lwIP (NO_SYS=0 mode) support for FreeRTOS
38  *  \ingroup pico_lwip_freertos
39  *
40  * Note that since lwIP may only be initialized once, and doesn't itself provide a shutdown mechanism, lwIP
41  * itself may still consume resources.
42  *
43  * It is however safe to call \ref lwip_freertos_init again later.
44  *
45  * \param context the async_context the lwip_freertos support was added to via \ref lwip_freertos_init
46 */
47 void lwip_freertos_deinit(async_context_t *context);
48 
49 #ifdef __cplusplus
50 }
51 #endif
52 #endif